Initial commit.
This commit is contained in:
commit
1d8f869b5b
39 changed files with 1671 additions and 0 deletions
1
src/core/README.md
Normal file
1
src/core/README.md
Normal file
|
|
@ -0,0 +1 @@
|
|||
Core lifecycle and public C API implementation.
|
||||
46
src/core/xtlite.c
Normal file
46
src/core/xtlite.c
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
#include "xtlite/xtlite.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
struct xt_app {
|
||||
unsigned int reserved;
|
||||
};
|
||||
|
||||
const char *xt_result_string(xt_result result)
|
||||
{
|
||||
switch (result) {
|
||||
case XT_OK: return "success";
|
||||
case XT_ERR_INVALID_ARGUMENT: return "invalid argument";
|
||||
case XT_ERR_OUT_OF_MEMORY: return "out of memory";
|
||||
case XT_ERR_NOT_FOUND: return "not found";
|
||||
case XT_ERR_INVALID_STATE: return "invalid state";
|
||||
case XT_ERR_IO: return "I/O error";
|
||||
case XT_ERR_UNSUPPORTED: return "unsupported operation";
|
||||
case XT_ERR_CAPACITY: return "capacity exceeded";
|
||||
case XT_ERR_GRAPH_CYCLE: return "graph contains a cycle";
|
||||
default: return "unknown error";
|
||||
}
|
||||
}
|
||||
|
||||
xt_result xt_app_create(xt_app **out_app)
|
||||
{
|
||||
xt_app *app;
|
||||
|
||||
if (out_app == NULL) {
|
||||
return XT_ERR_INVALID_ARGUMENT;
|
||||
}
|
||||
*out_app = NULL;
|
||||
|
||||
app = (xt_app *)calloc(1U, sizeof(*app));
|
||||
if (app == NULL) {
|
||||
return XT_ERR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
*out_app = app;
|
||||
return XT_OK;
|
||||
}
|
||||
|
||||
void xt_app_destroy(xt_app *app)
|
||||
{
|
||||
free(app);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue