Add files via upload

This commit is contained in:
StarFinger
2026-02-22 16:50:46 +03:00
committed by GitHub
commit 9f9f22f22c
8 changed files with 1349 additions and 0 deletions

22
type_info.h Normal file
View File

@@ -0,0 +1,22 @@
#ifndef TYPE_INFO_H
#define TYPE_INFO_H
#include <stdbool.h>
#include <stddef.h>
typedef struct TypeInfo {
size_t element_size;
void (*copy)(void *dest, const void *src);
void (*destroy)(void *elem);
int (*compare)(const void *a, const void *b); // <0, 0, >0
void (*print)(const void *elem);
bool (*parse)(void *dest, const char *str); // для ввода
const char *type_name;
} TypeInfo;
// static inline используется для создания копии функции в каждом файле
static inline bool types_equal(const TypeInfo *a, const TypeInfo *b) {
return a == b;
}
#endif // TYPE_INFO_H