updated README.md

This commit is contained in:
Timerix 2025-11-27 01:45:05 +05:00
parent 6978bb2afe
commit a0e280d77b

View File

@ -8,7 +8,9 @@ A fork of [libtoml](https://github.com/brglng/libtoml) rewritten to use [tlibc](
git clone https://timerix.ddns.net/git/Timerix/tlibtoml.git
```
2. Install [cbuild](https://timerix.ddns.net/git/Timerix/cbuild) version specified in `project.config`.
2. Install [cbuild](https://timerix.ddns.net/git/Timerix/cbuild/releases).
Select latest version compatible with the one in `project.config`.
Example: For `2.3.0` download latest `2.3.x`.
3. Clone [tlibc](https://timerix.ddns.net/git/Timerix/tlibc).
By default `dependencies/tlibc.config` expects that `tlibc/` is present in the same directory as `tlibtoml/`.
@ -32,11 +34,20 @@ A fork of [libtoml](https://github.com/brglng/libtoml) rewritten to use [tlibc](
int main(){
Deferral(32); // reserve memory for 32 defers
// init tlibc global variables
try_fatal_void(tlibc_init());
// init tlibtoml global variables
try_fatal_void(tlibtoml_init());
Defer(tlibc_deinit());
Defer(tlibtoml_deinit());
// load whole file to memory and parse it as toml
try_fatal(TomlTable* t, p, toml_load_filename("example.toml"));
// get value by key and ensure it's a string
try_fatal(str* s, p, TomlTable_get_str(t, STR("some_key")));
// print this string value
printf("some_key = '"FMT_str"'\n", str_expand(*s));
Return 0; // call defers
}
```