(INI) Initiated MemMan
(MOD) Extended abtilities of Status (ADD) Introduced CMake building system for Compound
This commit is contained in:
1
Var/.gitignore
vendored
Normal file
1
Var/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
obj/
|
19
Var/include/var.h
Normal file
19
Var/include/var.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#ifndef COMPOUND_VAR
|
||||
# define COMPOUND_VAR
|
||||
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
# include <wchar.h>
|
||||
# include <stdint.h>
|
||||
# include <Compound/common.h>
|
||||
|
||||
typedef struct {
|
||||
void *addr;
|
||||
size_t sz;
|
||||
} Var;
|
||||
|
||||
void var_swap(Var *v1, Var *v2);
|
||||
|
||||
int var_literalise(Var v, wchar_t **wbuff);
|
||||
|
||||
#endif /* COMPOUND_VAR */
|
17
Var/src/var.c
Normal file
17
Var/src/var.c
Normal file
@@ -0,0 +1,17 @@
|
||||
#include <Compound/var.h>
|
||||
|
||||
void var_swap(Var *v1, Var *v2)
|
||||
{
|
||||
Var v3 = {
|
||||
.addr = v1->addr,
|
||||
.sz = v1->sz
|
||||
};
|
||||
|
||||
*v1 = *v2;
|
||||
*v2 = v3;
|
||||
}
|
||||
|
||||
int var_literalise(Var v, wchar_t **wbuff)
|
||||
{
|
||||
return swprintf(*wbuff, (2*8 + 6), L"@[%p] +%u", v.addr, v.sz);
|
||||
}
|
Reference in New Issue
Block a user