(MOD) Refined Var, Array, CatlogMsg, CatlogSender, Status

This is the very first version that pass the compiler.  Though it has lots things were made for testing, such as commenting problematic source code to avoid irrelevant errors.  For test.c, everything is working fine.  Congrats!
This commit is contained in:
William
2024-05-20 04:47:39 +08:00
parent e73f3af436
commit e2f8dceda7
23 changed files with 656 additions and 393 deletions

View File

@@ -5,18 +5,21 @@
# include <Compound/common.h>
# include <Compound/status.h>
# include <Compound/catlog.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 "!@#$%^*()-=+;\'\"\\|,./<>?[]{}`~ "
// # define VAR_IDENTITY_LENGTH 64
// # define VAR_LITERALISE_LENGTH (VAR_IDENTITY_LENGTH + 16 + 9 + 10)
# define VAR_LITERALISE_LENGTH (16 + 9 + 10)
// # define VAR_LITERALISE_FORMAT ("%s @[%p]: %ld")
# define VAR_LITERALISE_FORMAT "@[%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 IllegalVarIdentity = {
// .description = "Given identity does not fit the standard of Var Naming "
// "convention.",
// .characteristic = STATUS_ERROR,
// .prev = &InvalidParameter
// };
// static Status VarIdentityTooLong = {
// .description = "Given identity has longer length that the maximum length "
@@ -31,8 +34,8 @@ typedef struct {
void *addr;
size_t size;
/* Identification */
char *identity; // Maximum up to VAR_IDENTITY_LENGTH
// /* Identification */
// char *identity; // Maximum up to VAR_IDENTITY_LENGTH
} Var;
@@ -43,13 +46,13 @@ typedef struct {
// };
// } _Var;
Status Var_Create(Var *inst, void *addr, size_t size, char *identity);
Status Var_Create(Var *inst, size_t size) throws(InsufficientMemory);
Status Var_CopyOf(Var *inst, Var *other);
Status Var_Literalise(Var *inst, char *buff);
bool Var_Equal(Var *a, Var *b);
bool Var_Equals(Var *a, Var *b);
void Var_Delete(Var *inst);
void VarUtils_Swap(Var *v1, Var *v2);
bool VarUtils_IsIdentityLegal(char *identity);
// bool VarUtils_IsIdentityLegal(char *identity);
#endif /* COMPOUND_VAR */