Adiciona tinyblocks-api, tinyblocks-libman e a tela "Escolha uma Extensão"
tinyblocks-api (gestor publico de modulos/libraries): - registry de modulos (embutidos + .so), load/unload/reload via dlopen, hot reload por mtime e introspeccao de tipos de bloco. - substitui a logica de hotlib duplicada no editor. tinyblocks-libman (gestor/buscador de libraries): - varre library.toml (libraries/ e ~/.tinyblocks/libraries), le metadados de forma RECURSIVA e resolve o caminho do .so/.a. - busca por texto e filtro por categoria; consulta o estado de carga na api. Editor: tela cheia "Escolha uma Extensão" (UI desenhada pelo editor, como no Scratch): botao Bibliotecas / Ctrl+L, busca, chips de categoria que quebram linha, grade de cartoes com faixa colorida e selo "carregada"; clicar carrega o .so via api. Respeito a interfaces publicas entre libraries: - libman deixa de incluir o ast.h (interno) do tinyblocks-toml e passa a usar uma API publica e opaca: tb_toml_open/close/str/int/int_array. - core ganha accessors publicos: tb_rt_type_count/at, tb_rt_library_count/at, tb_library_name/category/block_count; api e editor usam-nos em vez de ler campos de struct do core diretamente. Testes: make test-libman (novo) + step no harness que abre o libman, busca, carrega um .so e confirma a categoria na paleta. test-editor/toml/blueprint/ plugin seguem OK.
This commit is contained in:
1 parent
f616503caa
commit
dcc20985c5
20 files changed
+1143
-112
No files matched your search
@@ -23,6 +23,8 @@ JSON_DIR := $(LIBDIR)/tinyblocks-json
|
||||
XML_DIR := $(LIBDIR)/tinyblocks-xml
|
||||
CSV_DIR := $(LIBDIR)/tinyblocks-csv
|
||||
BP_DIR := $(LIBDIR)/tinyblocks-blueprint
|
||||
API_DIR := $(LIBDIR)/tinyblocks-api
|
||||
LIBM_DIR := $(LIBDIR)/tinyblocks-libman
|
||||
ED_DIR := $(LIBDIR)/tinyblocks-editor
|
||||
GX_DIR := $(LIBDIR)/tinyblocks-graphics
|
||||
SD_DIR := $(LIBDIR)/tinyblocks-sdl2
|
||||
@@ -67,6 +69,8 @@ JSON_A := $(JSON_DIR)/build/libtinyblocks-json.a
|
||||
XML_A := $(XML_DIR)/build/libtinyblocks-xml.a
|
||||
CSV_A := $(CSV_DIR)/build/libtinyblocks-csv.a
|
||||
BP_A := $(BP_DIR)/build/libtinyblocks-blueprint.a
|
||||
API_A := $(API_DIR)/build/libtinyblocks-api.a
|
||||
LIBM_A := $(LIBM_DIR)/build/libtinyblocks-libman.a
|
||||
LIB_LDFLAGS := -L$(ED_DIR)/build -L$(GX_DIR)/build -L$(SD_DIR)/build \
|
||||
$(foreach l,$(CAT_LIBS),-L$(LIBDIR)/tinyblocks-$(l)/build) -L$(BUILD)
|
||||
|
||||
@@ -76,7 +80,8 @@ LIB_LDFLAGS := -L$(ED_DIR)/build -L$(GX_DIR)/build -L$(SD_DIR)/build \
|
||||
category-libs category-sos libs \
|
||||
lib-events lib-control lib-operators lib-variables lib-appearance lib-pen lib-fs \
|
||||
lib-editor lib-graphics lib-sdl2 lib-python lib-mcp lib-toml \
|
||||
lib-json lib-xml lib-csv lib-blueprint
|
||||
lib-json lib-xml lib-csv lib-blueprint lib-api lib-libman \
|
||||
test-libman
|
||||
|
||||
all: static example ## Compila a biblioteca estática e o exemplo hello (padrão)
|
||||
|
||||
@@ -151,6 +156,12 @@ lib-csv:
|
||||
lib-blueprint:
|
||||
$(MAKE) -C $(BP_DIR)
|
||||
|
||||
lib-api:
|
||||
$(MAKE) -C $(API_DIR)
|
||||
|
||||
lib-libman: lib-api lib-toml
|
||||
$(MAKE) -C $(LIBM_DIR)
|
||||
|
||||
lib-graphics:
|
||||
$(MAKE) -C $(GX_DIR)
|
||||
|
||||
@@ -165,8 +176,8 @@ lib-mcp:
|
||||
|
||||
libs: static lib-events lib-control lib-operators lib-variables \
|
||||
lib-appearance lib-pen lib-fs lib-graphics lib-sdl2 lib-toml \
|
||||
lib-json lib-xml lib-csv lib-blueprint lib-editor
|
||||
@echo "Libraries OK: category + graphics + sdl2 + toml + json + xml + csv + blueprint + editor"
|
||||
lib-json lib-xml lib-csv lib-blueprint lib-api lib-libman lib-editor
|
||||
@echo "Libraries OK: category + graphics + sdl2 + toml + json + xml + csv + blueprint + api + libman + editor"
|
||||
|
||||
category-libs: static $(foreach l,$(CAT_LIBS),lib-$(l)) ## Compila as libraries de categoria (.a/.so)
|
||||
@echo "Build category libs OK"
|
||||
@@ -203,8 +214,9 @@ $(BUILD)/editor: examples/editor/main.c static libs
|
||||
-I$(ED_DIR)/include -I$(GFX_INC) $(CAT_INCS) \
|
||||
-I$(FS_DIR)/include -I$(TOML_DIR)/include \
|
||||
-I$(JSON_DIR)/include -I$(XML_DIR)/include -I$(CSV_DIR)/include -I$(BP_DIR)/include \
|
||||
-I$(API_DIR)/include -I$(LIBM_DIR)/include \
|
||||
$< -o $@ \
|
||||
-Wl,--start-group $(ED_A) $(GX_A) $(SD_A) $(TOML_A) $(JSON_A) $(XML_A) $(CSV_A) $(BP_A) $(CAT_A) $(LIB_A) -Wl,--end-group \
|
||||
-Wl,--start-group $(ED_A) $(GX_A) $(SD_A) $(TOML_A) $(JSON_A) $(XML_A) $(CSV_A) $(BP_A) $(API_A) $(LIBM_A) $(CAT_A) $(LIB_A) -Wl,--end-group \
|
||||
$(SDL2_LIBS) $(SDL2TTF_LIBS) -ldl -lm -rdynamic \
|
||||
'-Wl,-rpath,$$ORIGIN'
|
||||
|
||||
@@ -271,16 +283,19 @@ mcp-lib: static lib-mcp $(BUILD)/mcp.so ## Library cliente MCP -> build/mcp.so
|
||||
# ── Testes (harness headless com ASan/UBSan) ─────────────────────────────
|
||||
$(BUILD)/editor_harness: tests/editor_harness.c $(SRCS) \
|
||||
$(EDITOR_SRC)/tb_editor.c $(EDITOR_SRC)/tb_stage_widget.c \
|
||||
$(GX_DIR)/src/tb_graphics.c
|
||||
$(GX_DIR)/src/tb_graphics.c lib-blueprint
|
||||
@mkdir -p $(BUILD)
|
||||
$(CC) $(CFLAGS_DBG) \
|
||||
-I$(ED_DIR)/include -I$(EDITOR_SRC) -I$(GFX_INC) $(CAT_INCS) -I$(BP_DIR)/include \
|
||||
-I$(API_DIR)/include -I$(LIBM_DIR)/include -I$(TOML_DIR)/include \
|
||||
$(SRCS) \
|
||||
$(EDITOR_SRC)/tb_editor.c $(EDITOR_SRC)/tb_stage_widget.c \
|
||||
$(GX_DIR)/src/tb_graphics.c \
|
||||
$(BP_DIR)/src/blueprint.c $(BP_DIR)/src/serialize.c \
|
||||
$(API_DIR)/src/tb_api.c $(LIBM_DIR)/src/tb_libman.c \
|
||||
$(TOML_LIB_SRCS) $(TOML_DIR)/src/tb_toml.c \
|
||||
$(foreach l,$(CAT_LIBS),$(LIBDIR)/tinyblocks-$(l)/src/tb_$(l).c) \
|
||||
tests/editor_harness.c -o $@ -ldl -lm
|
||||
tests/editor_harness.c -o $@ -ldl -lm -rdynamic
|
||||
|
||||
test-editor: $(BUILD)/editor_harness ## Roda o harness headless do editor (ASan/UBSan)
|
||||
./$(BUILD)/editor_harness
|
||||
@@ -306,6 +321,23 @@ $(BUILD)/blueprint_test: tests/blueprint_test.c $(BP_LIB_SRCS) static
|
||||
test-blueprint: $(BUILD)/blueprint_test ## Roda o teste da blueprint (ASan/UBSan)
|
||||
./$(BUILD)/blueprint_test
|
||||
|
||||
# -- Teste do gestor de libraries (libman + api) ---
|
||||
$(BUILD)/libman_test: tests/libman_test.c \
|
||||
$(API_DIR)/src/tb_api.c $(LIBM_DIR)/src/tb_libman.c \
|
||||
$(TOML_LIB_SRCS) $(TOML_DIR)/src/tb_toml.c \
|
||||
$(foreach l,$(CAT_LIBS),$(LIBDIR)/tinyblocks-$(l)/src/tb_$(l).c) static
|
||||
@mkdir -p $(BUILD)
|
||||
$(CC) $(CFLAGS_DBG) -I$(API_DIR)/include -I$(LIBM_DIR)/include -I$(TOML_DIR)/include \
|
||||
$(CAT_INCS) \
|
||||
$(API_DIR)/src/tb_api.c $(LIBM_DIR)/src/tb_libman.c \
|
||||
$(TOML_LIB_SRCS) $(TOML_DIR)/src/tb_toml.c \
|
||||
$(foreach l,$(CAT_LIBS),$(LIBDIR)/tinyblocks-$(l)/src/tb_$(l).c) \
|
||||
tests/libman_test.c -o $@ \
|
||||
-Wl,--start-group $(LIB_A) -Wl,--end-group -ldl -lm
|
||||
|
||||
test-libman: $(BUILD)/libman_test ## Roda o teste do libman/api (ASan/UBSan)
|
||||
./$(BUILD)/libman_test
|
||||
|
||||
# -- Teste de plugin .so standalone ---
|
||||
FS_SO := $(FS_DIR)/build/libtinyblocks-fs.so
|
||||
|
||||
@@ -322,6 +354,7 @@ clean: ## Remove os diretórios build/ (raiz e libraries)
|
||||
$(RM) -r $(BUILD)
|
||||
@for d in $(EV_DIR) $(CT_DIR) $(OP_DIR) $(VR_DIR) $(AP_DIR) $(PN_DIR) $(FS_DIR) \
|
||||
$(TOML_DIR) $(JSON_DIR) $(XML_DIR) $(CSV_DIR) $(BP_DIR) \
|
||||
$(API_DIR) $(LIBM_DIR) \
|
||||
$(ED_DIR) $(GX_DIR) $(SD_DIR) $(PY_DIR) $(MC_DIR); do \
|
||||
$(MAKE) -C $$d clean >/dev/null 2>&1 || true; \
|
||||
done
|
||||
|
||||
Reference in new issue
Block a user