(SYNC) Synchronisation with local latest modifications.

This commit is contained in:
William
2024-06-24 22:34:47 +08:00
parent 95a49ebefa
commit 69d827c38e
18 changed files with 607 additions and 407 deletions

0
Utils/include/function.c Normal file
View File

34
Utils/include/function.h Normal file
View File

@@ -0,0 +1,34 @@
#ifndef FUNCTION_H
# define FUNCTION_H
# include <Compound/string.h>
typedef Var Type;
typedef struct {
attr(registered 1) Type type;
attr(nullity false) String identity;
attr(alignwith 1)
attr(optional true) Type value;
} Parameter;
typedef void * Block;
typedef struct {
Type returns;
Array type(Parameter) params;
Var type(Block) body;
} Function;
Status Function_Create(Function *inst, Type returns,
Array type(Parameter) params, Var type(Block) body);
Status Function_CopyOf(Function *inst, Function *other);
Status Function_Delete(Function *inst);
Status Function_Literalise(Function *inst, String *buff);
Status Function_Overwrite(Function *inst, Function *other);
bool Function_Equal(Function *inst, Function *other);
bool FunctionUtils_IsVariadic(Function *inst);
#endif /* FUNCTION_H */

57
Utils/include/test.c Normal file
View File

@@ -0,0 +1,57 @@
#include <Compound/array.h>
#include <Compound/catlog.h>
#include <Compound/common.h>
#include <Compound/memman.h>
#include <Compound/status.h>
#include <Compound/var.h>
Status func(void)
{
return apply(
error(ErrorStatus, "This function does not accept any parameters!"));
}
__attribute__((constructor))
void __CONSTRUCT__() {
cat("Hello, Compound!\n");
}
__attribute__((destructor))
void __DESTRUCT__() {}
Status Main(void)
{
// Memory mem1;
// seek(Memory_Create(&mem1, INT64_MAX), {
// print_status(_);
// });
// seek(Memory_Allocate(&mem1), {
// print_status(_);
// });
// seek(Memory_Allocate(&mem1), {
// print_status(_);
// });
// seek(Memory_Release(&mem1), {
// print_status(_);
// });
// seek(Memory_Release(&mem1), {
// print_status(_);
// });
// seek(Memory_Delete(&mem1), {
// print_status(_);
// });
// PrintStatusDump(unknown(normal(MaximumLiteralisationLengthExceeded, ":O"), "OMGIDKWTD", 1));
// PrintStatusDump(apply(extend(MaximumLiteralisationLengthExceeded, normal(UnavailableBuffer, "OMGIDKWTD"))));
PrintStatusDump(MaximumLiteralisationLengthExceeded);
return apply(NormalStatus);
}
int main(void)
{
return Main().value;
}

View File

@@ -1,11 +1,9 @@
#ifndef COMPOUND_UTILS_H
# define COMPOUND_UTILS_H
# include <time.h>
# include <string.h>
# include <stdlib.h>
# include <math.h>
# include <stdint.h>
# include <string.h>
# include <time.h>
# include <Compound/common.h>
# include <Compound/const.h>
@@ -19,6 +17,8 @@ int Utils_CalcDigits(long long int n);
int Utils_LiteraliseInteger(long long int n, char *buff);
int Utils_DateTimeLiteralise(time_t t, char *buff);
// int Utils_DateTimeLiteralise(time_t t, char *buff);
int Utils_DateTimeLiteralise(time_t timer, char *buff,
const char *__restrict format);
#endif /* COMPOUND_UTILS_H */

View File

@@ -42,8 +42,8 @@ int Utils_LiteraliseInteger(long long int n, char *buff)
return literalising_len;
}
int Utils_DateTimeLiteralise(time_t t, char *buff)
int Utils_DateTimeLiteralise(time_t timer, char *buff,
const char *__restrict format)
{
return 0;
}