summaryrefslogtreecommitdiffhomepage
path: root/public
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-04-24 13:38:05 +0200
committerAmlal El Mahrouss <amlal@nekernel.org>2025-04-24 13:38:05 +0200
commitde88c44c68f3941e003ddaf13042875370f10978 (patch)
tree14b0909de5d6d10fc7ef44fc470d210f21e94f25 /public
parente6185ca92212ab0686892a1a12efd392f895c1f7 (diff)
dev, tooling: Improve the tools and frameworks on userspace.
Details: - See commit details for more. Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'public')
-rw-r--r--public/frameworks/CoreFoundation.fwrk/headers/Array.h2
-rw-r--r--public/tools/cc/cc.json2
-rw-r--r--public/tools/diutil/diutil.json2
-rw-r--r--public/tools/diutil/src/CommandLine.cc14
-rw-r--r--public/tools/fwrkld/src/CommandLine.cc14
-rw-r--r--public/tools/ld.dyn/.keep (renamed from public/tools/fwrkld/.keep)0
-rw-r--r--public/tools/ld.dyn/ld.dyn.json (renamed from public/tools/fwrkld/fwrkld.json)4
-rw-r--r--public/tools/ld.dyn/src/CommandLine.cc47
-rw-r--r--public/tools/ld.fwrk/.keep (renamed from public/tools/fwrkld/dist/.keep)0
-rw-r--r--public/tools/ld.fwrk/ld.fwrk.json (renamed from public/tools/ld/ld.json)4
-rw-r--r--public/tools/ld.fwrk/src/CommandLine.cc20
-rw-r--r--public/tools/ld/.keep0
-rw-r--r--public/tools/ld/dist/.keep0
-rw-r--r--public/tools/ld/src/CommandLine.cc15
-rw-r--r--public/tools/make_app/dist/.keep0
-rw-r--r--public/tools/make_app/make_app.json12
-rw-r--r--public/tools/mk.fwrk/Common.h (renamed from public/tools/make_app/Common.h)0
-rw-r--r--public/tools/mk.fwrk/Framework.h (renamed from public/tools/make_app/Framework.h)0
-rw-r--r--public/tools/mk.fwrk/Steps.h (renamed from public/tools/make_app/Steps.h)0
-rw-r--r--public/tools/mk.fwrk/mk.fwrk.json18
-rw-r--r--public/tools/mk.fwrk/src/CommandLine.cc (renamed from public/tools/make_app/src/CommandLine.cc)24
-rw-r--r--public/tools/mk.hefs/mk.hefs.json2
-rw-r--r--public/tools/mk.hefs/src/CommandLine.cc2
-rw-r--r--public/tools/mk.nefs/mk.nefs.json2
-rw-r--r--public/tools/mk.nefs/src/CommandLine.cc2
-rw-r--r--public/tools/open/src/CommandLine.cc12
26 files changed, 121 insertions, 77 deletions
diff --git a/public/frameworks/CoreFoundation.fwrk/headers/Array.h b/public/frameworks/CoreFoundation.fwrk/headers/Array.h
index 4b8cdbb2..e9a36ac4 100644
--- a/public/frameworks/CoreFoundation.fwrk/headers/Array.h
+++ b/public/frameworks/CoreFoundation.fwrk/headers/Array.h
@@ -40,7 +40,7 @@ namespace CF
{
auto cnt = 0UL;
- for (auto i = 0; i < N; ++i)
+ for (auto i = 0UL; i < N; ++i)
{
if (fArray[i])
++cnt;
diff --git a/public/tools/cc/cc.json b/public/tools/cc/cc.json
index a40008ba..9e6da4c6 100644
--- a/public/tools/cc/cc.json
+++ b/public/tools/cc/cc.json
@@ -1,5 +1,5 @@
{
- "compiler_path": "g++",
+ "compiler_path": "x86_64-w64-mingw32-g++",
"compiler_std": "c++20",
"headers_path": ["./", "../../../dev"],
"sources_path": ["src/CommandLine.cc"],
diff --git a/public/tools/diutil/diutil.json b/public/tools/diutil/diutil.json
index 19b845c5..a7a49697 100644
--- a/public/tools/diutil/diutil.json
+++ b/public/tools/diutil/diutil.json
@@ -1,5 +1,5 @@
{
- "compiler_path": "g++",
+ "compiler_path": "x86_64-w64-mingw32-g++",
"compiler_std": "c++20",
"headers_path": ["./", "../../../dev/kernel", "../../../public/frameworks/", "../../../dev/", "./"],
"sources_path": ["src/CommandLine.cc", "../../../public/frameworks/DiskImage.fwrk/src/*.cc", "../../../dev/user/src/*.cc"],
diff --git a/public/tools/diutil/src/CommandLine.cc b/public/tools/diutil/src/CommandLine.cc
index 3e7353e6..ef0aaa2e 100644
--- a/public/tools/diutil/src/CommandLine.cc
+++ b/public/tools/diutil/src/CommandLine.cc
@@ -9,40 +9,40 @@
#include <DiskImage.fwrk/headers/DiskImage.h>
-static const Char kDiskName[kDIDiskNameLen] = "DISK";
+static const Char kDiskName[kDIDiskNameLen] = "Empty Disk";
static SInt32 kDiskSectorSz = kDISectorSz;
static SizeT kDiskSz = gib_cast(4);
static const Char kOutDisk[kDIOutNameLen] = "disk.eimg";
/// @brief Disk Utility entrypoint.
-int main(int argc, char** argv)
+SInt32 _NeMain(SInt32 argc, Char** argv)
{
for (SInt32 arg = 0; arg < argc; ++arg)
{
const Char* arg_s = argv[arg];
- if (MmCmpMemory((VoidPtr)arg_s, (VoidPtr) "--disk-output-name", MmStrLen("--disk-output-name") == 0))
+ if (MmCmpMemory((VoidPtr)arg_s, (VoidPtr) "-diutil-output-name", MmStrLen("-diutil-output-name") == 0))
{
if ((arg + 1) < argc)
{
MmCopyMemory((VoidPtr)kOutDisk, argv[arg + 1], kDIDiskNameLen);
}
}
- else if (MmCmpMemory((VoidPtr)arg_s, (VoidPtr) "--disk-output-size", MmStrLen("--disk-output-size") == 0))
+ else if (MmCmpMemory((VoidPtr)arg_s, (VoidPtr) "-diutil-output-size", MmStrLen("-diutil-output-size") == 0))
{
if ((arg + 1) < argc)
{
kDiskSz = StrMathToNumber(argv[arg + 1], nullptr, 10);
}
}
- else if (MmCmpMemory((VoidPtr)arg_s, (VoidPtr) "--disk-sector-size", MmStrLen("--disk-sector-size") == 0))
+ else if (MmCmpMemory((VoidPtr)arg_s, (VoidPtr) "-diutil-sector-size", MmStrLen("-diutil-sector-size") == 0))
{
if ((arg + 1) < argc)
{
kDiskSectorSz = StrMathToNumber(argv[arg + 1], nullptr, 10);
}
}
- else if (MmCmpMemory((VoidPtr)arg_s, (VoidPtr) "--disk-part-name", MmStrLen("--disk-part-name") == 0))
+ else if (MmCmpMemory((VoidPtr)arg_s, (VoidPtr) "-diutil-part-name", MmStrLen("-diutil-part-name") == 0))
{
if ((arg + 1) < argc)
{
@@ -51,7 +51,7 @@ int main(int argc, char** argv)
}
}
- // create disk image.
+ // create disk image, by appending an EPM partition to it.
DI::DI_DISK_IMAGE img{};
diff --git a/public/tools/fwrkld/src/CommandLine.cc b/public/tools/fwrkld/src/CommandLine.cc
deleted file mode 100644
index f86c0383..00000000
--- a/public/tools/fwrkld/src/CommandLine.cc
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * Created on Thu Oct 17 08:00:42 CEST 2024
- *
- * Copyright (c) 2024-2025 Amlal El Mahrouss
- */
-
-#include <user/SystemCalls.h>
-
-/// @brief This program loads a code framework into Kernel's memory.
-
-SInt32 main(SInt32 argc, Char* argv[])
-{
- return EXIT_FAILURE;
-}
diff --git a/public/tools/fwrkld/.keep b/public/tools/ld.dyn/.keep
index e69de29b..e69de29b 100644
--- a/public/tools/fwrkld/.keep
+++ b/public/tools/ld.dyn/.keep
diff --git a/public/tools/fwrkld/fwrkld.json b/public/tools/ld.dyn/ld.dyn.json
index 940c3a89..0ace838f 100644
--- a/public/tools/fwrkld/fwrkld.json
+++ b/public/tools/ld.dyn/ld.dyn.json
@@ -1,9 +1,9 @@
{
- "compiler_path": "g++",
+ "compiler_path": "x86_64-w64-mingw32-g++",
"compiler_std": "c++20",
"headers_path": ["./", "../../../dev"],
"sources_path": ["src/CommandLine.cc"],
- "output_name": "./dist/fwrkld",
+ "output_name": "./dist/ld.dyn",
"cpp_macros": [
"kLDVersion=0x0100",
"kLDVersionHighest=0x0100",
diff --git a/public/tools/ld.dyn/src/CommandLine.cc b/public/tools/ld.dyn/src/CommandLine.cc
new file mode 100644
index 00000000..90a79796
--- /dev/null
+++ b/public/tools/ld.dyn/src/CommandLine.cc
@@ -0,0 +1,47 @@
+/*
+ * Created on Thu Oct 17 08:00:42 CEST 2024
+ *
+ * Copyright (c) 2024-2025 Amlal El Mahrouss
+ */
+
+#include <user/SystemCalls.h>
+
+/// @brief Library loader.
+
+#define DYNLIB_FLAG "-dyn"
+
+SInt32 _NeMain(SInt32 argc, Char* argv[])
+{
+ SCI_UNUSED(argc);
+ SCI_UNUSED(argv);
+
+ PrintOut(nullptr, "%s", "ld.dyn: Dynamic Loader.\n");
+ PrintOut(nullptr, "%s", "ld.dyn: © 2024-2025 Amlal El Mahrouss, All rights reserved.\n");
+
+ for (SInt32 i = 1U; i < argc; ++i)
+ {
+ if (MmStrCmp(argv[i], DYNLIB_FLAG) == 0)
+ {
+ UIntPtr ret = RtlSpawnProcess(argv[i], 0, nullptr, nullptr, 0);
+
+ if (0 < ret)
+ {
+ return RtlSpawnIB(ret);
+ }
+
+ PrintOut(nullptr, "%s", "ld.dyn: Failed to load the library.\n");
+ PrintOut(nullptr, "%s", "ld.dyn: Make sure the library is valid.\n");
+
+ break;
+ }
+ else
+ {
+ PrintOut(nullptr, "%s", "ld.dyn: Invalid argument.\n");
+ PrintOut(nullptr, "%s", "ld.dyn: Use -dyn <path> to load a dynamic library.\n");
+
+ break;
+ }
+ }
+
+ return EXIT_FAILURE;
+}
diff --git a/public/tools/fwrkld/dist/.keep b/public/tools/ld.fwrk/.keep
index e69de29b..e69de29b 100644
--- a/public/tools/fwrkld/dist/.keep
+++ b/public/tools/ld.fwrk/.keep
diff --git a/public/tools/ld/ld.json b/public/tools/ld.fwrk/ld.fwrk.json
index 940c3a89..b0a2d0e2 100644
--- a/public/tools/ld/ld.json
+++ b/public/tools/ld.fwrk/ld.fwrk.json
@@ -1,9 +1,9 @@
{
- "compiler_path": "g++",
+ "compiler_path": "x86_64-w64-mingw32-g++",
"compiler_std": "c++20",
"headers_path": ["./", "../../../dev"],
"sources_path": ["src/CommandLine.cc"],
- "output_name": "./dist/fwrkld",
+ "output_name": "./dist/ld.fwrk",
"cpp_macros": [
"kLDVersion=0x0100",
"kLDVersionHighest=0x0100",
diff --git a/public/tools/ld.fwrk/src/CommandLine.cc b/public/tools/ld.fwrk/src/CommandLine.cc
new file mode 100644
index 00000000..cdb57133
--- /dev/null
+++ b/public/tools/ld.fwrk/src/CommandLine.cc
@@ -0,0 +1,20 @@
+/*
+ * Created on Thu Oct 17 08:00:42 CEST 2024
+ *
+ * Copyright (c) 2024-2025 Amlal El Mahrouss
+ */
+
+#include <user/SystemCalls.h>
+
+/// @brief This program loads a code framework into Kernel's memory.
+
+SInt32 _NeMain(SInt32 argc, Char* argv[])
+{
+ SCI_UNUSED(argc);
+ SCI_UNUSED(argv);
+
+ PrintOut(nullptr, "%s", "ld.fwrk: Framework Loader.\n");
+ PrintOut(nullptr, "%s", "ld.fwrk: © 2024-2025 Amlal El Mahrouss, All rights reserved.\n");
+
+ return EXIT_FAILURE;
+}
diff --git a/public/tools/ld/.keep b/public/tools/ld/.keep
deleted file mode 100644
index e69de29b..00000000
--- a/public/tools/ld/.keep
+++ /dev/null
diff --git a/public/tools/ld/dist/.keep b/public/tools/ld/dist/.keep
deleted file mode 100644
index e69de29b..00000000
--- a/public/tools/ld/dist/.keep
+++ /dev/null
diff --git a/public/tools/ld/src/CommandLine.cc b/public/tools/ld/src/CommandLine.cc
deleted file mode 100644
index ace93ed3..00000000
--- a/public/tools/ld/src/CommandLine.cc
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * Created on Thu Oct 17 08:00:42 CEST 2024
- *
- * Copyright (c) 2024-2025 Amlal El Mahrouss
- */
-
-#include <user/SystemCalls.h>
-
-/// @brief Placeholder program.
-
-SInt32 main(SInt32 argc, Char* argv[])
-{
- PrintOut(nullptr, "ld: A linker to be installed.\rld: This program is present as a placeholder.");
- return EXIT_FAILURE;
-}
diff --git a/public/tools/make_app/dist/.keep b/public/tools/make_app/dist/.keep
deleted file mode 100644
index e69de29b..00000000
--- a/public/tools/make_app/dist/.keep
+++ /dev/null
diff --git a/public/tools/make_app/make_app.json b/public/tools/make_app/make_app.json
deleted file mode 100644
index f40b9eff..00000000
--- a/public/tools/make_app/make_app.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "compiler_path": "g++",
- "compiler_std": "c++20",
- "headers_path": ["./", "../../../dev"],
- "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/Common.h b/public/tools/mk.fwrk/Common.h
index 09e374ee..09e374ee 100644
--- a/public/tools/make_app/Common.h
+++ b/public/tools/mk.fwrk/Common.h
diff --git a/public/tools/make_app/Framework.h b/public/tools/mk.fwrk/Framework.h
index ab03d0bc..ab03d0bc 100644
--- a/public/tools/make_app/Framework.h
+++ b/public/tools/mk.fwrk/Framework.h
diff --git a/public/tools/make_app/Steps.h b/public/tools/mk.fwrk/Steps.h
index 51927def..51927def 100644
--- a/public/tools/make_app/Steps.h
+++ b/public/tools/mk.fwrk/Steps.h
diff --git a/public/tools/mk.fwrk/mk.fwrk.json b/public/tools/mk.fwrk/mk.fwrk.json
new file mode 100644
index 00000000..f7f0ba8c
--- /dev/null
+++ b/public/tools/mk.fwrk/mk.fwrk.json
@@ -0,0 +1,18 @@
+{
+ "compiler_path": "x86_64-w64-mingw32-g++",
+ "compiler_std": "c++20",
+ "headers_path": ["./", "../../../dev", "../../../public/frameworks"],
+ "sources_path": ["src/CommandLine.cc"],
+ "compiler_flags": [
+ "-Wall",
+ "-Wextra",
+ "-Wpedantic",
+ "-fPIC"
+ ],
+ "output_name": "./dist/mk.fwrk",
+ "cpp_macros": [
+ "kMKAppVersion=0x0100",
+ "kMKAppVersionHighest=0x0100",
+ "kMKAppVersionLowest=0x0100"
+ ]
+}
diff --git a/public/tools/make_app/src/CommandLine.cc b/public/tools/mk.fwrk/src/CommandLine.cc
index c30e02a0..8f142dfb 100644
--- a/public/tools/make_app/src/CommandLine.cc
+++ b/public/tools/mk.fwrk/src/CommandLine.cc
@@ -13,45 +13,45 @@
/// @brief This program makes a framework/app/steps directory for NeKernel OS.
-static Char* kStepsName = "Steps";
-static Char* kStepsAuthor = "John Doe";
-static Char* kStepsCompany = "Company, Inc";
+static const Char* kStepsName = "Steps";
+static const Char* kStepsAuthor = "John Doe";
+static const Char* kStepsCompany = "Company, Inc";
-int main(int argc, char* argv[])
+SInt32 _NeMain(SInt32 argc, Char* argv[])
{
CF::CFArray<const char*, 256U> files;
auto ext = kFKExtension;
- for (SizeT i = 2UL; i < argc; ++i)
+ for (SInt32 i = 2UL; i < argc; ++i)
{
if (MmStrCmp(argv[i], "-h") == 0)
{
PrintOut(nullptr, "%s", "make_app: Framework/Application Creation Tool.\n");
PrintOut(nullptr, "%s", "make_app: © 2024-2025 Amlal El Mahrouss, All rights reserved.\n");
- PrintOut(nullptr, "%s", "make_app: -a: Application format.\n");
- PrintOut(nullptr, "%s", "make_app: -s: Steps (Setup pages) format.\n");
- PrintOut(nullptr, "%s", "make_app: -f: Framework format.\n");
+ PrintOut(nullptr, "%s", "make_app: -a: Application Directory.\n");
+ PrintOut(nullptr, "%s", "make_app: -s: Steps (Setup pages) Directory.\n");
+ PrintOut(nullptr, "%s", "make_app: -f: Framework Directory.\n");
return kErrorSuccess;
}
if (MmStrCmp(argv[i], "--author") == 0)
{
- MmCopyMemory(kStepsAuthor, const_cast<Char*>(argv[i + 1]), MmStrLen(argv[i + 1]));
+ MmCopyMemory(const_cast<Char*>(kStepsAuthor), const_cast<Char*>(argv[i + 1]), MmStrLen(argv[i + 1]));
continue;
}
if (MmStrCmp(argv[i], "--company") == 0)
{
- MmCopyMemory(kStepsCompany, const_cast<Char*>(argv[i + 1]), MmStrLen(argv[i + 1]));
+ MmCopyMemory(const_cast<Char*>(kStepsCompany), const_cast<Char*>(argv[i + 1]), MmStrLen(argv[i + 1]));
continue;
}
if (MmStrCmp(argv[i], "--name") == 0)
{
- MmCopyMemory(kStepsName, const_cast<Char*>(argv[i + 1]), MmStrLen(argv[i + 1]));
+ MmCopyMemory(const_cast<Char*>(kStepsName), const_cast<Char*>(argv[i + 1]), MmStrLen(argv[i + 1]));
continue;
}
@@ -105,7 +105,7 @@ int main(int argc, char* argv[])
handle = nullptr;
}
- for (SInt32 i = 0; i < files.Count(); ++i)
+ for (auto i = 0UL; i < files.Count(); ++i)
{
auto& file = files[i];
diff --git a/public/tools/mk.hefs/mk.hefs.json b/public/tools/mk.hefs/mk.hefs.json
index 03f925cf..9fed938c 100644
--- a/public/tools/mk.hefs/mk.hefs.json
+++ b/public/tools/mk.hefs/mk.hefs.json
@@ -1,5 +1,5 @@
{
- "compiler_path": "g++",
+ "compiler_path": "x86_64-w64-mingw32-g++",
"compiler_std": "c++20",
"headers_path": ["./", "../../../dev"],
"sources_path": ["src/CommandLine.cc"],
diff --git a/public/tools/mk.hefs/src/CommandLine.cc b/public/tools/mk.hefs/src/CommandLine.cc
index 8ce77208..0c30e1b1 100644
--- a/public/tools/mk.hefs/src/CommandLine.cc
+++ b/public/tools/mk.hefs/src/CommandLine.cc
@@ -8,7 +8,7 @@
/// @brief Placeholder program.
-SInt32 main(SInt32 argc, Char* argv[])
+SInt32 _NeMain(SInt32 argc, Char* argv[])
{
SCI_UNUSED(argc);
SCI_UNUSED(argv);
diff --git a/public/tools/mk.nefs/mk.nefs.json b/public/tools/mk.nefs/mk.nefs.json
index e92e0b9c..62a4e93c 100644
--- a/public/tools/mk.nefs/mk.nefs.json
+++ b/public/tools/mk.nefs/mk.nefs.json
@@ -1,5 +1,5 @@
{
- "compiler_path": "g++",
+ "compiler_path": "x86_64-w64-mingw32-g++",
"compiler_std": "c++20",
"headers_path": ["./", "../../../dev"],
"sources_path": ["src/CommandLine.cc"],
diff --git a/public/tools/mk.nefs/src/CommandLine.cc b/public/tools/mk.nefs/src/CommandLine.cc
index 8ce77208..0c30e1b1 100644
--- a/public/tools/mk.nefs/src/CommandLine.cc
+++ b/public/tools/mk.nefs/src/CommandLine.cc
@@ -8,7 +8,7 @@
/// @brief Placeholder program.
-SInt32 main(SInt32 argc, Char* argv[])
+SInt32 _NeMain(SInt32 argc, Char* argv[])
{
SCI_UNUSED(argc);
SCI_UNUSED(argv);
diff --git a/public/tools/open/src/CommandLine.cc b/public/tools/open/src/CommandLine.cc
index 7ba7b7f6..b3779c71 100644
--- a/public/tools/open/src/CommandLine.cc
+++ b/public/tools/open/src/CommandLine.cc
@@ -13,19 +13,19 @@
#define OPEN_APP_HELP_FLAG "-h"
#define OPEN_APP_BASE_PATH "/app/"
-SInt32 main(SInt32 argc, Char* argv[])
+SInt32 _NeMain(SInt32 argc, Char* argv[])
{
if (argc == 1)
return EXIT_FAILURE;
- for (SizeT i = 1UL; i < argc; ++i)
+ PrintOut(nullptr, "open: Open Loader.\n");
+ PrintOut(nullptr, "open: © 2024-2025 Amlal El Mahrouss, All rights reserved.\n");
+
+ for (SInt32 i = 1U; i < argc; ++i)
{
if (MmStrCmp(argv[i], OPEN_APP_HELP_FLAG) == 0)
{
- PrintOut(nullptr, "open: open .app(s) directories.\n");
- PrintOut(nullptr, "open: © 2024-2025 Amlal El Mahrouss, All rights reserved.\n");
-
- PrintOut(nullptr, "open: %s: Application is being taken as the input (opens a PEF/PE32+/ELF program depending on the CPU architecture).\n", OPEN_APP_APP_FLAG);
+ PrintOut(nullptr, "open: %s: Application is being taken as the input (opens a PEF/PE32+ program depending on the CPU architecture).\n", OPEN_APP_APP_FLAG);
return EXIT_SUCCESS;
}