made all toml_load* functions public

This commit is contained in:
Timerix 2025-11-27 00:31:47 +05:00
parent 7a0570b0b9
commit 3e21766514
2 changed files with 18 additions and 13 deletions

View File

@ -48,11 +48,26 @@ typedef List(TomlValue) TomlArray;
// Parser //
// //
//////////////////////////////////////////////////////////////////////////////
Result(TomlTable*) toml_load_str(str s);
Result(TomlTable*) toml_load_file(FILE* file);
/// opens file
Result(TomlTable*) toml_load_filename(cstr filename);
/// @param filename to use in error messages
Result(TomlTable*) toml_load_str_filename(str s, cstr filename);
/// loads whole file in memory
/// @param filename to use in error messages
Result(TomlTable*) toml_load_file_filename(FILE* file, cstr filename);
static inline Result(TomlTable*) toml_load_str(str s){
return toml_load_str_filename(s, "<string>");
}
static inline Result(TomlTable*) toml_load_file(FILE* file){
return toml_load_file_filename(file, "<stream>");
}
/* TODO: implement dump functions
str toml_dump_str(const TomlTable* self, TomlErr *err);
void toml_dump_file(const TomlTable* self, FILE* file, TomlErr *err);

View File

@ -30,16 +30,6 @@ Result(TomlTable*) toml_load_file_filename(FILE* file, cstr filename)
Return RESULT_VALUE(p, table);
}
Result(TomlTable*) toml_load_str(str s)
{
return toml_load_str_filename(s, "<string>");
}
Result(TomlTable*) toml_load_file(FILE* file)
{
return toml_load_file_filename(file, "<stream>");
}
Result(TomlTable*) toml_load_filename(cstr filename)
{
Deferral(1);