From 7cde157ec8b4c587daf8621d04fb7e0711deadef Mon Sep 17 00:00:00 2001 From: cfif Date: Tue, 30 Sep 2025 15:52:33 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D1=8B=20=D0=B8=D0=BD=D1=82=D0=B5=D1=80=D1=84=D0=B5=D0=B9?= =?UTF-8?q?=D1=81=D1=8B=20=D0=B8=20=D0=B4=D1=80=D0=B0=D0=B9=D0=B2=D0=B5?= =?UTF-8?q?=D1=80=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VersionsInfoTable.c | 26 ++++++++++++++++++++++++++ VersionsInfoTable.h | 32 ++++++++++++++++++++++++++++++++ modular.json | 17 +++++++++++++++++ 3 files changed, 75 insertions(+) create mode 100644 VersionsInfoTable.c create mode 100644 VersionsInfoTable.h create mode 100644 modular.json diff --git a/VersionsInfoTable.c b/VersionsInfoTable.c new file mode 100644 index 0000000..0ec9d90 --- /dev/null +++ b/VersionsInfoTable.c @@ -0,0 +1,26 @@ +// +// Created by xemon on 10.11.22. +// + +#include "VersionsInfoTable.h" + +void VersionsInfoTable_Init(tVersionsInfoTable *env, tVersionPair *memAlloc, uint16_t memAllocLen) { + env->items = memAlloc; + env->limits = memAllocLen; + env->count = 0; +} + +bool VersionsInfoTable_Add(tVersionsInfoTable *env, char *name, uint8_t nameSize, tStringLink value) { + if (env->count >= env->limits) { + return false; + } + + tVersionPair *newPair = env->items + env->count; + newPair->name.data = name; + newPair->name.length = nameSize; + newPair->value = value; + + ++env->count; + + return true; +} \ No newline at end of file diff --git a/VersionsInfoTable.h b/VersionsInfoTable.h new file mode 100644 index 0000000..82eb0b3 --- /dev/null +++ b/VersionsInfoTable.h @@ -0,0 +1,32 @@ +// +// Created by xemon on 10.11.22. +// + +#ifndef UVEOS_ON_NATION_VERSIONSTABLE_H +#define UVEOS_ON_NATION_VERSIONSTABLE_H + +#include "BaseTypes.h" +#include "stddef.h" +#include "stdbool.h" + +typedef struct { + tStringStatic name; + tStringLink value; +} tVersionPair; + +typedef struct { + tVersionPair *items; + uint16_t limits; + uint16_t count; +} tVersionsInfoTable; + +void VersionsInfoTable_Init(tVersionsInfoTable *env, tVersionPair *memAlloc, uint16_t memAllocLen); + +#define VersionsInfoTable_InitStatic(ENV, MEM) VersionsInfoTable_Init(ENV,MEM,sizeof(MEM)) + +bool VersionsInfoTable_Add(tVersionsInfoTable *env, char *name, uint8_t nameSize, tStringLink value); + +#define VersionsInfoTable_AddStatic(ENV, NAME, VALUE) VersionsInfoTable_Add(ENV,NAME,sizeof(NAME)-1,VALUE) + + +#endif //UVEOS_ON_NATION_VERSIONSTABLE_H diff --git a/modular.json b/modular.json new file mode 100644 index 0000000..1f4455e --- /dev/null +++ b/modular.json @@ -0,0 +1,17 @@ +{ + "dep": [ + { + "type": "git", + "provider": "HVAC_M7", + "repo": "BaseTypes" + } + ], + "cmake": { + "inc_dirs": [ + "./" + ], + "srcs": [ + "./**.c" + ] + } +} \ No newline at end of file