diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-11-19 19:41:49 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-11-19 19:41:49 +0100 |
| commit | 73adafc405eae26d9c65809ca5612967b8f534cb (patch) | |
| tree | 35ac20be06594c133c46dccb983049ebee7fc0a2 /lib/libsteps/dev | |
| parent | 712140303d88a0e7e689376c862954811623c5ae (diff) | |
feat: libsteps: improvements on the steps library.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'lib/libsteps/dev')
| -rw-r--r-- | lib/libsteps/dev/.keep | 0 | ||||
| -rw-r--r-- | lib/libsteps/dev/lib/defines.hpp | 13 | ||||
| -rw-r--r-- | lib/libsteps/dev/lib/steps.hpp | 45 |
3 files changed, 58 insertions, 0 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/dev/lib/steps.hpp b/lib/libsteps/dev/lib/steps.hpp new file mode 100644 index 0000000..97af5f5 --- /dev/null +++ b/lib/libsteps/dev/lib/steps.hpp @@ -0,0 +1,45 @@ +/* ------------------------------------------- + +Copyright (C) 2025, Amlal El Mahrouss, licensed under the Apache 2.0 license. + +------------------------------------------- */ + +#pragma once + +#include <libsteps/dev/lib/defines.hpp> + +#define kStepsExtension ".stp" +#define kStepsStrLen (256U) + +#define kStepsMagic " pls" +#define kStepsMagicLen (4U) +#define kStepsVersion (0x0100) + +namespace steps { +struct record final { + 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; +}; + +namespace operators { +/// =========================================================== /// +/// @brief Equal operator for steps records. +/// =========================================================== /// +inline bool operator==(const record &r, const record &l) { + 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, kStepsMagicLen) > 0); +} +} // namespace operators +} // namespace steps |
