summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-11-19 19:41:49 +0100
committerAmlal El Mahrouss <amlal@nekernel.org>2025-11-19 19:41:49 +0100
commit73adafc405eae26d9c65809ca5612967b8f534cb (patch)
tree35ac20be06594c133c46dccb983049ebee7fc0a2
parent712140303d88a0e7e689376c862954811623c5ae (diff)
feat: libsteps: improvements on the steps library.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
-rw-r--r--lib/libsteps/dev/.keep0
-rw-r--r--lib/libsteps/dev/lib/defines.hpp13
-rw-r--r--lib/libsteps/dev/lib/steps.hpp (renamed from lib/libsteps/steps.h)28
-rwxr-xr-xlib/libsteps/make_dist_linux.sh12
-rwxr-xr-xlib/libsteps/make_dist_osx.sh11
-rw-r--r--tools/steps.cc21
6 files changed, 60 insertions, 25 deletions
diff --git a/lib/libsteps/dev/.keep b/lib/libsteps/dev/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/lib/libsteps/dev/.keep
diff --git a/lib/libsteps/dev/lib/defines.hpp b/lib/libsteps/dev/lib/defines.hpp
new file mode 100644
index 0000000..4c7c38b
--- /dev/null
+++ b/lib/libsteps/dev/lib/defines.hpp
@@ -0,0 +1,13 @@
+/* -------------------------------------------
+
+Copyright (C) 2025, Amlal El Mahrouss, licensed under the Apache 2.0 license.
+
+------------------------------------------- */
+
+#pragma once
+
+#ifdef OCL_USE_UTF8
+#undef OCL_USE_UTF8
+#endif
+
+#include <lib/core/includes.hpp>
diff --git a/lib/libsteps/steps.h b/lib/libsteps/dev/lib/steps.hpp
index 357f0df..97af5f5 100644
--- a/lib/libsteps/steps.h
+++ b/lib/libsteps/dev/lib/steps.hpp
@@ -6,24 +6,22 @@ Copyright (C) 2025, Amlal El Mahrouss, licensed under the Apache 2.0 license.
#pragma once
-#include <lib/core/includes.hpp>
+#include <libsteps/dev/lib/defines.hpp>
-#define kSysStepsExtension ".stp"
-#define kSysStepsStrLen (256U)
+#define kStepsExtension ".stp"
+#define kStepsStrLen (256U)
-#define kSysStepsMagic " pls"
-#define kSysStepsMagicLen (4U)
-#define kSysStepsVersion (0x0100)
-
-#define kStepsMime "ne-application-kind/steps"
+#define kStepsMagic " pls"
+#define kStepsMagicLen (4U)
+#define kStepsVersion (0x0100)
namespace steps {
struct record final {
- char magic[kSysStepsMagicLen] = {kSysStepsMagic[0], kSysStepsMagic[1],
- kSysStepsMagic[2], kSysStepsMagic[3]};
- char name[kSysStepsStrLen] = "";
- char company[kSysStepsStrLen] = "";
- char author[kSysStepsStrLen] = "";
+ ocl::char_type magic[kStepsMagicLen] = {kStepsMagic[0], kStepsMagic[1],
+ kStepsMagic[2], kStepsMagic[3]};
+ ocl::char_type name[kStepsStrLen] = "";
+ ocl::char_type company[kStepsStrLen] = "";
+ ocl::char_type author[kStepsStrLen] = "";
int32_t version = 0;
int32_t pages = 0;
int32_t check_page = 0, eula_page = 0;
@@ -34,14 +32,14 @@ namespace operators {
/// @brief Equal operator for steps records.
/// =========================================================== ///
inline bool operator==(const record &r, const record &l) {
- return (std::strncmp(r.magic, l.magic, kSysStepsMagicLen) == 0);
+ return (std::strncmp(r.magic, l.magic, kStepsMagicLen) == 0);
}
/// =========================================================== ///
/// @brief Not equal operator for steps records.
/// =========================================================== ///
inline bool operator!=(const record &r, const record &l) {
- return (std::strncmp(r.magic, l.magic, kSysStepsMagicLen) > 0);
+ return (std::strncmp(r.magic, l.magic, kStepsMagicLen) > 0);
}
} // namespace operators
} // namespace steps
diff --git a/lib/libsteps/make_dist_linux.sh b/lib/libsteps/make_dist_linux.sh
new file mode 100755
index 0000000..fe58a8d
--- /dev/null
+++ b/lib/libsteps/make_dist_linux.sh
@@ -0,0 +1,12 @@
+#! /bin/sh
+
+outputDir=dist/lib/
+
+mkdir -p $outputDir
+
+for f in *.hpp; do
+baseName=`echo $f | cut -d "." -f 1`
+echo "RUN:" cp --parents $f.hpp $outputDir$baseName
+cp --parents $f.hpp $outputDir$baseName
+done
+
diff --git a/lib/libsteps/make_dist_osx.sh b/lib/libsteps/make_dist_osx.sh
new file mode 100755
index 0000000..318ae4d
--- /dev/null
+++ b/lib/libsteps/make_dist_osx.sh
@@ -0,0 +1,11 @@
+#! /bin/sh
+
+outputDir=dist/
+
+mkdir -p $outputDir
+
+for f in *.hpp; do
+baseName=`echo $f | cut -d "." -f 1`
+echo "RUN:" ditto $baseName.hpp $outputDir$baseName
+ditto $baseName.hpp $outputDir$baseName
+done
diff --git a/tools/steps.cc b/tools/steps.cc
index 551203c..3b61ef2 100644
--- a/tools/steps.cc
+++ b/tools/steps.cc
@@ -4,24 +4,25 @@ Copyright (C) 2025, Amlal El Mahrouss, licensed under the Apache 2.0 license.
------------------------------------------- */
-#include <lib/io/print.hpp>
-#include <libsteps/steps.h>
+#include <libocl/dev/lib/io/print.hpp>
+#include <libsteps/dev/lib/steps.hpp>
+/// =========================================================== ///
/// Use operators from steps namespace to compare steps records.
+/// =========================================================== ///
using namespace steps::operators;
/// =========================================================== ///
/// @brief Main function for running steps on NeKernel.
/// =========================================================== ///
-int main(int argc, char** argv)
-{
- ocl::io::print("steps: running steps for program...\n");
+int main(int argc, char **argv) {
+ ocl::io::print("steps: running steps for program...\n");
+
+ steps::record steps;
- steps::record steps;
+ /// AMLALE: Read steps from file and process them.
- /// AMLALE: Read steps from file and process them.
-
- ocl::io::print("steps: done!\n");
+ ocl::io::print("steps: done.\n");
- return EXIT_SUCCESS;
+ return EXIT_SUCCESS;
} \ No newline at end of file