readme
This commit is contained in:
parent
d9daae8c5e
commit
3034e4d186
@ -15,8 +15,9 @@ C library with collections, strings, exceptions, io...
|
|||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
Put this code at the beginning of `main()`
|
Include `tlibc/tlibc.h` and put this code at the beginning of `main()`.
|
||||||
```
|
```
|
||||||
// tlibc/tlibc.h
|
Deferral(32);
|
||||||
try_fatal_void(tlibc_init());
|
try_fatal_void(tlibc_init());
|
||||||
|
Defer(tlibc_deinit());
|
||||||
```
|
```
|
||||||
|
|||||||
@ -36,11 +36,11 @@ void Error_printAndExit(Error* e) ATTRIBUTE_NORETURN;
|
|||||||
void _ErrorCodePage_register(u16* error_code_page_ptr);
|
void _ErrorCodePage_register(u16* error_code_page_ptr);
|
||||||
#define ErrorCodePage_register(name) _ErrorCodePage_register(&ErrorCodePage_name(name));
|
#define ErrorCodePage_register(name) _ErrorCodePage_register(&ErrorCodePage_name(name));
|
||||||
|
|
||||||
typedef enum TLIBC_ERROR {
|
typedef enum TlibcError {
|
||||||
TLIBC_ERROR_UNKNOWN
|
TLIBC_ERROR_UNKNOWN
|
||||||
} TLIBC_ERROR;
|
} TlibcError;
|
||||||
#define ErrorCodePage_NONE 0
|
#define ErrorCodePage_NONE 0
|
||||||
ErrorCodePage_declare(TLIBC_ERROR);
|
ErrorCodePage_declare(TLIBC);
|
||||||
ErrorCodePage_declare(LIBC_ERRNO);
|
ErrorCodePage_declare(LIBC_ERRNO);
|
||||||
|
|
||||||
typedef struct Result_ {
|
typedef struct Result_ {
|
||||||
|
|||||||
@ -56,7 +56,7 @@ void Error_printAndExit(Error* e){
|
|||||||
exit(111);
|
exit(111);
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorCodePage_define(TLIBC_ERROR);
|
ErrorCodePage_define(TLIBC);
|
||||||
ErrorCodePage_define(LIBC_ERRNO);
|
ErrorCodePage_define(LIBC_ERRNO);
|
||||||
|
|
||||||
static u16 _error_code_page_last = 0;
|
static u16 _error_code_page_last = 0;
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
Result(void) tlibc_init(){
|
Result(void) tlibc_init(){
|
||||||
Deferral(8);
|
Deferral(8);
|
||||||
|
|
||||||
ErrorCodePage_register(TLIBC_ERROR);
|
ErrorCodePage_register(TLIBC);
|
||||||
ErrorCodePage_register(LIBC_ERRNO);
|
ErrorCodePage_register(LIBC_ERRNO);
|
||||||
|
|
||||||
Return RESULT_VOID;
|
Return RESULT_VOID;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user