Начало
This commit is contained in:
commit
eddcf8433a
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
@ -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
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
"dep": [
|
||||||
|
{
|
||||||
|
"type": "git",
|
||||||
|
"provider": "HVAC_DEV",
|
||||||
|
"repo": "BaseTypes"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"cmake": {
|
||||||
|
"inc_dirs": [
|
||||||
|
"./"
|
||||||
|
],
|
||||||
|
"srcs": [
|
||||||
|
"./**.c"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue