(SOC) Storage Only Commit Sat 22 Jun 15:03:45 CST 2024
This commit is contained in:
23
.gitignore
vendored
Normal file
23
.gitignore
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
*CMakeFiles
|
||||
*CMakeFiles/*
|
||||
*CMakeCache*
|
||||
cmake_install.cmake
|
||||
*[tT]est*
|
||||
*~
|
||||
gitwork
|
||||
work
|
||||
Makefile
|
||||
*sublime*
|
||||
found
|
||||
todo_stack
|
||||
getReady.sh
|
||||
base_type.c
|
||||
sample
|
||||
<<<<<<< HEAD
|
||||
compile
|
||||
=======
|
||||
>>>>>>> refs/remotes/master/master
|
||||
.vscode/
|
||||
todo
|
||||
vsc*
|
||||
libcompound.so
|
12
CMakeLists.txt
Normal file
12
CMakeLists.txt
Normal file
@@ -0,0 +1,12 @@
|
||||
cmake_minimum_required (VERSION 3.5)
|
||||
|
||||
project (Conjurer)
|
||||
|
||||
set(CMAKE_C_COMPILER gcc)
|
||||
|
||||
add_compile_options(-g -std=c99 -Wall -Wextra -Wformat -D__DEBUG__)
|
||||
|
||||
LINK_LIBRARIES(compound)
|
||||
|
||||
add_executable(ConjurerTest
|
||||
test.c)
|
58
main.c
Normal file
58
main.c
Normal file
@@ -0,0 +1,58 @@
|
||||
#include <Compound/status.h>
|
||||
#include <Compound/string.h>
|
||||
#include <Compound/var.h>
|
||||
|
||||
Status Main(Array type(String) *args)
|
||||
{
|
||||
nonull(args, apply(UnavailableParameter));
|
||||
|
||||
return apply(NormalStatus);
|
||||
}
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
{
|
||||
state(!argc || !argv, Main(NULL).value);
|
||||
|
||||
/* Construct argv. */
|
||||
Array type(String) Arguments;
|
||||
notok(Array_Create(&Arguments, argc, sizeof(String)), {
|
||||
PrintStatusDump(apply(annot(_,
|
||||
"Failed to create array for argv.")));
|
||||
return _.value;
|
||||
});
|
||||
|
||||
/* Assigning contents from argv. */
|
||||
for (register int i = 0; i < Arguments.len; i++) {
|
||||
String Current;
|
||||
notok(String_Create(&Current, strlen(argv[i])), {
|
||||
PrintStatusDump(apply(annot(_,
|
||||
"Failed to create string instance for contents from argv.")));
|
||||
return _.value;
|
||||
})
|
||||
notok(StringUtils_FromCharBuff(&Current, argv[i]), {
|
||||
PrintStatusDump(apply(annot(_,
|
||||
"Failed to convert char buffer into string.")));
|
||||
(void)String_Delete(&Current);
|
||||
return _.value;
|
||||
})
|
||||
/* Set value with Current. */
|
||||
notok(Array_SetIdx(&Arguments, &Current.data.members[0], i), {
|
||||
PrintStatusDump(apply(annot(_,
|
||||
"Failed to set member for "nameof(Arguments)".")));
|
||||
return _.value;
|
||||
})
|
||||
(void)String_Delete(&Current);
|
||||
}
|
||||
|
||||
/* Start the programme. */
|
||||
int rtn;
|
||||
notok(Main(&Arguments), {
|
||||
PrintStatusDump(_);
|
||||
rtn = _.value;
|
||||
})
|
||||
|
||||
/* Destruct argv. */
|
||||
(void)Array_Delete(&Arguments);
|
||||
|
||||
return rtn;
|
||||
}
|
Reference in New Issue
Block a user