(SOC) Storage Only Commit

(ADD) Name, NameScope, Catlog, Object, String, Attribute, Char, Registry, Utils, Type, <Platform Support>, <Global Constants>, README

(MOD) Array, Var, Status, MemMan, <Common>
This commit is contained in:
William
2024-05-16 00:04:42 +08:00
parent 989e512f8f
commit 5f7a6c6f93
32 changed files with 1694 additions and 195 deletions

View File

@@ -2,18 +2,52 @@
# define COMPOUND_VAR
# include <stdio.h>
# include <stdlib.h>
# include <wchar.h>
# include <stdint.h>
# include <Compound/common.h>
# include <Compound/status.h>
# define VAR_IDENTITY_LENGTH 64
# define VAR_LITERALISE_LENGTH (VAR_IDENTITY_LENGTH + 16 + 9 + 10)
# define VAR_LITERALISE_FORMAT ("%s @[%p]: %ld")
# define VAR_IDENTITY_ILLEGAL_CHAR "!@#$%^*()-=+;\'\"\\|,./<>?[]{}`~ "
static Status IllegalVarIdentity = {
.description = "Given identity does not fit the standard of Var Naming "
"convension.",
.characteristic = STATUS_ERROR,
.prev = &InvalidParameter
};
// static Status VarIdentityTooLong = {
// .description = "Given identity has longer length that the maximum length "
// "limitation.",
// .characteristic = STATUS_ERROR,
// .prev = &IllegalVarIdentity
// };
typedef struct {
/* Data */
void *addr;
size_t sz;
size_t size;
/* Identification */
char *identity; // Maximum up to VAR_IDENTITY_LENGTH
} Var;
void var_swap(Var *v1, Var *v2);
// typedef struct {
// union {
// /* Self Pointing (Var) */
// const Var *__this__;
// };
// } _Var;
int var_literalise(Var v, wchar_t **wbuff);
Status Var_Create(Var *inst, void *addr, size_t size, char *identity);
Status Var_CopyOf(Var *inst, Var *other);
void Var_Delete(Var *inst);
Status VarUtils_Literalise(Var *inst, char *buff);
void VarUtils_Swap(Var *v1, Var *v2);
bool VarUtils_IsIdentityLegal(char *identity);
#endif /* COMPOUND_VAR */