summaryrefslogtreecommitdiffhomepage
path: root/public
diff options
context:
space:
mode:
Diffstat (limited to 'public')
-rw-r--r--public/frameworks/.keep0
-rw-r--r--public/tools/.keep0
-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/CommandLine.cc80
-rw-r--r--public/tools/open/dist/.keep0
-rw-r--r--public/tools/open/open.json13
-rw-r--r--public/tools/open/src/CommandLine.cc49
11 files changed, 204 insertions, 0 deletions
diff --git a/public/frameworks/.keep b/public/frameworks/.keep
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/public/frameworks/.keep
diff --git a/public/tools/.keep b/public/tools/.keep
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/public/tools/.keep
diff --git a/public/tools/make_app/Common.h b/public/tools/make_app/Common.h
new file mode 100644
index 00000000..7dead76c
--- /dev/null
+++ b/public/tools/make_app/Common.h
@@ -0,0 +1,19 @@
+/**
+ Sat Oct 26 07:03:28 AM CEST 2024
+ (c) Amlal EL Mahrouss.
+*/
+
+#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..48db2599
--- /dev/null
+++ b/public/tools/make_app/Framework.h
@@ -0,0 +1,17 @@
+/**
+ Thu Oct 17 07:57:43 CEST 2024
+ (c) Amlal EL Mahrouss.
+*/
+
+#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..d7f78b81
--- /dev/null
+++ b/public/tools/make_app/Steps.h
@@ -0,0 +1,14 @@
+/**
+ Thu Oct 17 07:57:43 CEST 2024
+ (c) Amlal EL Mahrouss.
+*/
+
+#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..abfe5cd3
--- /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/CommandLine.cc"],
+ "output_name": "./dist/make_app",
+ "cpp_macros": [
+ "kMKFVersion=0x0100",
+ "kMKFVersionHighest=0x0100",
+ "kMKFVersionLowest=0x0100"
+ ]
+}
diff --git a/public/tools/make_app/src/CommandLine.cc b/public/tools/make_app/src/CommandLine.cc
new file mode 100644
index 00000000..f2f4f26d
--- /dev/null
+++ b/public/tools/make_app/src/CommandLine.cc
@@ -0,0 +1,80 @@
+/*
+ * Created on Thu Oct 17 08:00:42 CEST 2024
+ *
+ * Copyright (c) 2024 Amlal EL Mahrouss
+ */
+
+#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_app: Framework/Application Creation Tool.\n";
+ std::cout << "make_app: © Amlal EL Mahrouss, All rights reserved.\n";
+
+ std::cout << "make_app: -app: Application directory.\n";
+ std::cout << "make_app: -steps: Steps (Setup pages) directory.\n";
+ std::cout << "make_app: -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;
+}
diff --git a/public/tools/open/dist/.keep b/public/tools/open/dist/.keep
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/public/tools/open/dist/.keep
diff --git a/public/tools/open/open.json b/public/tools/open/open.json
new file mode 100644
index 00000000..04012ab3
--- /dev/null
+++ b/public/tools/open/open.json
@@ -0,0 +1,13 @@
+{
+ "compiler_path": "cscc",
+ "compiler_std": "c++20",
+ "headers_path": ["./"],
+ "sources_path": ["src/CommandLine.cc"],
+ "output_name": "./dist/open",
+ "compiler_flags": "-lSCI",
+ "cpp_macros": [
+ "kOpenVersion=0x0100",
+ "kOpenVersionHighest=0x0100",
+ "kOpenVersionLowest=0x0100"
+ ]
+}
diff --git a/public/tools/open/src/CommandLine.cc b/public/tools/open/src/CommandLine.cc
new file mode 100644
index 00000000..86282059
--- /dev/null
+++ b/public/tools/open/src/CommandLine.cc
@@ -0,0 +1,49 @@
+/*
+ * Created on Thu Oct 17 08:00:42 CEST 2024
+ *
+ * Copyright (c) 2024 Amlal EL Mahrouss
+ */
+
+#include <LibSCI/SCI.h>
+
+/// @brief This program opens an application from **OPEN_APP_BASE_PATH**
+
+#define OPEN_APP_APP_FLAG "-a"
+#define OPEN_APP_HELP_FLAG "-h"
+#define OPEN_APP_BASE_PATH "/app/"
+
+int main(int argc, char* argv[])
+{
+ if (argc == 1)
+ return EXIT_FAILURE;
+
+ for (SizeT i = 1UL; i < argc; ++i)
+ {
+ if (MmStrCmp(argv[i], OPEN_APP_HELP_FLAG) == 0)
+ {
+ ConOut(nullptr, "open: Open Tool.\n");
+ ConOut(nullptr, "open: © Amlal EL Mahrouss, All rights reserved.\n");
+
+ ConOut(nullptr, "open: %s: Application is taken as input (opens a PEF/PE32+/ELF program depending on architecture).\n", OPEN_APP_APP_FLAG);
+
+ return EXIT_SUCCESS;
+ }
+ else if (MmStrCmp(argv[i], OPEN_APP_APP_FLAG) == 0)
+ {
+ if ((i + 1) == argc)
+ return EXIT_FAILURE;
+
+ Char base_path[FILE_MAX_LEN] = OPEN_APP_BASE_PATH;
+ MmCopyMemory(base_path + MmStrLen(OPEN_APP_BASE_PATH), argv[i + 1], MmStrLen(argv[i + 1]));
+
+ Bool ret = RtlSpawnProcess(base_path, 0, nullptr, nullptr, 0);
+
+ if (ret > 0)
+ return EXIT_SUCCESS;
+
+ break;
+ }
+ }
+
+ return EXIT_FAILURE;
+}