/* * TinyBlocks - tb_libman.h * Library tinyblocks-libman: gestor/buscador de libraries. * * Varre diretorios em busca de arquivos "library.toml", le os metadados * (usando tinyblocks-toml) e resolve os caminhos dos .so/.a. Sabe tambem * se uma library ja esta carregada, consultando tinyblocks-api. * * NAO desenha UI: o editor e quem desenha a tela de escolha de extensao. */ #ifndef TINYBLOCKS_LIBMAN_H #define TINYBLOCKS_LIBMAN_H #include #include #ifdef __cplusplus extern "C" { #endif #define TBLM_MAX_ENTRIES 128 #define TBLM_NAME_LEN 64 #define TBLM_DESC_LEN 200 #define TBLM_PATH_LEN 512 typedef struct TbLibmanEntry { char name[TBLM_NAME_LEN]; char version[24]; char category[48]; char description[TBLM_DESC_LEN]; unsigned char color[4]; unsigned char dark[4]; char toml[TBLM_PATH_LEN]; /* caminho do library.toml */ char dir[TBLM_PATH_LEN]; /* diretorio da library */ char shared[TBLM_PATH_LEN]; /* caminho do .so (pode nao existir) */ char staticlib[TBLM_PATH_LEN]; /* caminho do .a */ char depends[160]; } TbLibmanEntry; /* -- Ciclo de vida --- */ TB_API bool tb_libman_init(TinyBlocks* rt); /* liga ao tinyblocks-api */ TB_API void tb_libman_shutdown(void); TB_API const char* tb_libman_last_error(void); /* -- Varredura --- */ TB_API void tb_libman_clear(void); /* Varre 'root' recursivamente (ate max_depth niveis) procurando library.toml. */ TB_API int tb_libman_scan(const char* root, int max_depth); /* Varre os diretorios padrao: "libraries", "./libraries" e * "$HOME/.tinyblocks/libraries". */ TB_API int tb_libman_scan_defaults(void); TB_API int tb_libman_count(void); TB_API const TbLibmanEntry* tb_libman_entry(int i); /* -- Estado / instalacao (via tinyblocks-api) --- */ TB_API bool tb_libman_loaded(int i); TB_API int tb_libman_install(int i); /* tb_api_load(entry->shared) */ /* -- Filtros --- */ /* Preenche out[] com os indices cujo nome/categoria/descricao contem 'query' * (case-insensitive) e cuja categoria casa com 'category' (NULL ou "" = todas). * Retorna quantos indices foram escritos (ate 'max'). */ TB_API int tb_libman_search(const char* query, const char* category, int* out, int max); /* Categorias distintas encontradas (sem repeticao). Retorna n. */ TB_API int tb_libman_categories(char out[][48], int max); #ifdef __cplusplus } #endif #endif /* TINYBLOCKS_LIBMAN_H */