/* * TinyBlocks - tb_toml.h * Library tinyblocks-toml: parser de TOML (lexer + AST) e metadados de * library. Tambem expoe o bloco Toml.Get para scripts. */ #ifndef TINYBLOCKS_TOML_H #define TINYBLOCKS_TOML_H #include #ifdef __cplusplus extern "C" { #endif /* Documento TOML opaco: consumidores NAO acessam os campos internos. * (a definicao concreta fica em ast.h, interno a tinyblocks-toml) */ typedef struct TomlDoc TbTomlDoc; TB_API const TinyBlocks_LibraryDescriptor* tb_toml_get_library(void); /* Le um valor escalar de um arquivo .toml (ex.: "library.category"). * Retorna o valor em 'out' ou o default. Util para metadados de library. */ TB_API const char* tb_toml_file_get(const char* path, const char* dotted, const char* def); /* -- Documento via interface publica (encapsula ast.h) --- */ TB_API TbTomlDoc* tb_toml_open(const char* path); /* NULL em erro */ TB_API void tb_toml_close(TbTomlDoc* doc); /* Le um escalar em 'dotted' (ex.: "library.name"). Retorna def se ausente. */ TB_API const char* tb_toml_str(const TbTomlDoc* doc, const char* dotted, const char* def); /* Le um inteiro. */ TB_API long long tb_toml_int(const TbTomlDoc* doc, const char* dotted, long long def); /* Le um array de inteiros; preenche 'max' itens (ausentes = def) e retorna * quantos itens o array tinha (limitado a max). */ TB_API int tb_toml_int_array(const TbTomlDoc* doc, const char* dotted, int* out, int max, int def); #ifdef __cplusplus } #endif #endif /* TINYBLOCKS_TOML_H */