Headers do editor em include/, com a API privada atrás de um guard
- tb_editor_internal.h e tb_editor_modules.h (antes em internal/) e tb_stage_widget.h (antes em src/) foram para libraries/tinyblocks-editor/include/. - Os três são API privada: só compilam com TB_EDITOR_PRIVATE_API (o editor, os módulos do bundle e o harness definem); fora disso um #error manda incluir tb_editor.h. - Includes viraram <tb_editor_internal.h> etc.; Makefiles sem -Isrc / -Iinternal; library.toml descreve os fontes e o define. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b610a05904
commit
81f198f189
13 files changed
+44
-21
No files matched your search
@@ -280,7 +280,7 @@ EIMG_DIR := $(ED_DIR)/libraries/tinyblocks-editor-image
|
||||
EW_A := $(EW_DIR)/build/libtinyblocks-editor-widgets.a
|
||||
EIMG_A := $(EIMG_DIR)/build/libtinyblocks-editor-image.a
|
||||
EFILES_DIR := $(ED_DIR)/libraries/tinyblocks-editor-files
|
||||
EDITOR_HDRS := $(EDITOR_SRC)/tb_stage_widget.h $(ED_DIR)/include/tb_editor.h $(GFX_HDR) $(HDRS)
|
||||
EDITOR_HDRS := $(ED_DIR)/include/tb_stage_widget.h $(ED_DIR)/include/tb_editor.h $(GFX_HDR) $(HDRS)
|
||||
|
||||
$(BUILD)/editor: examples/editor/main.c static libs
|
||||
$(CC) $(CFLAGS_REL) \
|
||||
@@ -450,7 +450,7 @@ $(BUILD)/editor_harness: tests/editor_harness.c $(SRCS) \
|
||||
$(GX_DIR)/src/tb_graphics.c lib-blueprint ed-modules
|
||||
@mkdir -p $(BUILD)
|
||||
$(CC) $(CFLAGS_DBG) \
|
||||
-I$(ED_DIR)/include -I$(EDITOR_SRC) -I$(ED_DIR)/internal -I$(EW_DIR)/include -I$(EIMG_DIR)/include -I$(EFILES_DIR)/include -I$(GFX_INC) $(CAT_INCS) -I$(BP_DIR)/include \
|
||||
-I$(ED_DIR)/include -DTB_EDITOR_PRIVATE_API -I$(EW_DIR)/include -I$(EIMG_DIR)/include -I$(EFILES_DIR)/include -I$(GFX_INC) $(CAT_INCS) -I$(BP_DIR)/include \
|
||||
-I$(API_DIR)/include -I$(LIBM_DIR)/include -I$(EN_DIR)/include -I$(TOML_DIR)/include -I$(CV_DIR)/include -I$(B64_DIR)/include -I$(PPM_DIR)/include -I$(SYN_DIR)/include -I$(SB_DIR)/include \
|
||||
$(SRCS) \
|
||||
$(EDITOR_SRC)/tb_editor.c $(EDITOR_SRC)/tb_stage_widget.c \
|
||||
|
||||
@@ -6,8 +6,8 @@ BUILD := build
|
||||
CORE := ../../build
|
||||
|
||||
CFLAGS := -std=c11 -Wall -Wextra -pedantic -fvisibility=hidden \
|
||||
-D_POSIX_C_SOURCE=200809L \
|
||||
-I../../include -Iinclude -Isrc \
|
||||
-D_POSIX_C_SOURCE=200809L -DTB_EDITOR_PRIVATE_API \
|
||||
-I../../include -Iinclude \
|
||||
-I../tinyblocks-graphics/include \
|
||||
-I../tinyblocks-variables/include \
|
||||
-I../tinyblocks-blueprint/include \
|
||||
@@ -36,8 +36,8 @@ all: static shared
|
||||
static: $(LIB_A)
|
||||
shared: $(LIB_SO)
|
||||
|
||||
$(BUILD)/tb_editor.o: src/tb_editor.c include/tb_editor.h internal/tb_editor_internal.h \
|
||||
src/tb_stage_widget.h \
|
||||
$(BUILD)/tb_editor.o: src/tb_editor.c include/tb_editor.h include/tb_editor_internal.h \
|
||||
include/tb_stage_widget.h \
|
||||
$(WIDGETS_DIR)/include/tb_editor_widgets.h \
|
||||
$(IMG_DIR)/include/tb_editor_image.h \
|
||||
$(FILES_DIR)/include/tb_editor_files.h \
|
||||
@@ -52,13 +52,13 @@ $(BUILD)/tb_editor.o: src/tb_editor.c include/tb_editor.h internal/tb_editor_int
|
||||
@mkdir -p $(BUILD)
|
||||
$(CC) $(CFLAGS) -fPIC -c $< -o $@
|
||||
|
||||
$(BUILD)/tb_stage_widget.o: src/tb_stage_widget.c src/tb_stage_widget.h \
|
||||
$(BUILD)/tb_stage_widget.o: src/tb_stage_widget.c include/tb_stage_widget.h \
|
||||
../tinyblocks-graphics/include/tb_graphics.h
|
||||
@mkdir -p $(BUILD)
|
||||
$(CC) $(CFLAGS) -fPIC -c $< -o $@
|
||||
|
||||
$(BUILD)/tb_editor_modules.o: src/tb_editor_modules.c internal/tb_editor_modules.h \
|
||||
internal/tb_editor_internal.h
|
||||
$(BUILD)/tb_editor_modules.o: src/tb_editor_modules.c include/tb_editor_modules.h \
|
||||
include/tb_editor_internal.h
|
||||
@mkdir -p $(BUILD)
|
||||
$(CC) $(CFLAGS) -fPIC -c $< -o $@
|
||||
|
||||
|
||||
+8
-1
@@ -8,6 +8,13 @@
|
||||
#ifndef TB_EDITOR_INTERNAL_H
|
||||
#define TB_EDITOR_INTERNAL_H
|
||||
|
||||
/* API PRIVADA do editor: so o editor, os modulos do bundle dele
|
||||
(libraries/tinyblocks-editor-*) e o harness de testes compilam com
|
||||
TB_EDITOR_PRIVATE_API. Para usar o editor, inclua tb_editor.h. */
|
||||
#ifndef TB_EDITOR_PRIVATE_API
|
||||
# error "API privada do editor: inclua tb_editor.h (ou compile com -DTB_EDITOR_PRIVATE_API)"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -30,7 +37,7 @@
|
||||
#include <tb_editor_widgets.h>
|
||||
#include <tb_editor_image.h>
|
||||
#include <tb_editor_files.h>
|
||||
#include "../internal/tb_editor_modules.h"
|
||||
#include "tb_editor_modules.h"
|
||||
|
||||
#ifndef TB_EW_UNUSED
|
||||
#define TB_EW_UNUSED __attribute__((unused))
|
||||
+7
@@ -10,6 +10,13 @@
|
||||
#ifndef TB_EDITOR_MODULES_H
|
||||
#define TB_EDITOR_MODULES_H
|
||||
|
||||
/* API PRIVADA do editor: so o editor, os modulos do bundle dele
|
||||
(libraries/tinyblocks-editor-*) e o harness de testes compilam com
|
||||
TB_EDITOR_PRIVATE_API. Para usar o editor, inclua tb_editor.h. */
|
||||
#ifndef TB_EDITOR_PRIVATE_API
|
||||
# error "API privada do editor: inclua tb_editor.h (ou compile com -DTB_EDITOR_PRIVATE_API)"
|
||||
#endif
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <tinyblocks/tb_renderable_block.h>
|
||||
+7
@@ -5,6 +5,13 @@
|
||||
#ifndef TINYBLOCKS_EDITOR_STAGE_WIDGET_H
|
||||
#define TINYBLOCKS_EDITOR_STAGE_WIDGET_H
|
||||
|
||||
/* API PRIVADA do editor: so o editor, os modulos do bundle dele
|
||||
(libraries/tinyblocks-editor-*) e o harness de testes compilam com
|
||||
TB_EDITOR_PRIVATE_API. Para usar o editor, inclua tb_editor.h. */
|
||||
#ifndef TB_EDITOR_PRIVATE_API
|
||||
# error "API privada do editor: inclua tb_editor.h (ou compile com -DTB_EDITOR_PRIVATE_API)"
|
||||
#endif
|
||||
|
||||
#include <tinyblocks/tinyblocks.h>
|
||||
|
||||
/* Registra o TypeBlock Editor.Stage na library do editor */
|
||||
@@ -7,7 +7,7 @@ CFLAGS := -std=c11 -Wall -Wextra -pedantic \
|
||||
-DTB_EDITOR_FILES_BUILD \
|
||||
-D_POSIX_C_SOURCE=200809L \
|
||||
-I../../../../include -Iinclude \
|
||||
-I../../internal \
|
||||
-I../../include -DTB_EDITOR_PRIVATE_API \
|
||||
-I../tinyblocks-editor-widgets/include \
|
||||
-I../tinyblocks-editor-image/include \
|
||||
-I../../../tinyblocks-graphics/include \
|
||||
@@ -28,7 +28,7 @@ static: $(LIB_A)
|
||||
shared: $(LIB_SO)
|
||||
|
||||
$(BUILD)/tb_editor_files.o: src/tb_editor_files.c include/tb_editor_files.h \
|
||||
../../internal/tb_editor_internal.h \
|
||||
../../include/tb_editor_internal.h \
|
||||
../tinyblocks-editor-widgets/include/tb_editor_widgets.h
|
||||
@mkdir -p $(BUILD)
|
||||
$(CC) $(CFLAGS) -fPIC -c $< -o $@
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "../../../internal/tb_editor_internal.h"
|
||||
#include <tb_editor_internal.h>
|
||||
#include "tb_editor_files.h"
|
||||
|
||||
/* -- Geometria ------------------------------------------------------------ */
|
||||
|
||||
@@ -7,7 +7,7 @@ CFLAGS := -std=c11 -Wall -Wextra -pedantic \
|
||||
-DTB_EDITOR_IMAGE_BUILD \
|
||||
-D_POSIX_C_SOURCE=200809L \
|
||||
-I../../../../include -Iinclude \
|
||||
-I../../internal \
|
||||
-I../../include -DTB_EDITOR_PRIVATE_API \
|
||||
-I../tinyblocks-editor-widgets/include \
|
||||
-I../tinyblocks-editor-files/include \
|
||||
-I../../../tinyblocks-graphics/include \
|
||||
@@ -28,7 +28,7 @@ static: $(LIB_A)
|
||||
shared: $(LIB_SO)
|
||||
|
||||
$(BUILD)/tb_editor_image.o: src/tb_editor_image.c include/tb_editor_image.h \
|
||||
../../internal/tb_editor_internal.h \
|
||||
../../include/tb_editor_internal.h \
|
||||
../tinyblocks-editor-widgets/include/tb_editor_widgets.h
|
||||
@mkdir -p $(BUILD)
|
||||
$(CC) $(CFLAGS) -fPIC -c $< -o $@
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* Como as demais, pode ser usada como .so independente: os simbolos do
|
||||
* editor ficam pendentes e sao resolvidos na carga.
|
||||
*/
|
||||
#include "../../../internal/tb_editor_internal.h"
|
||||
#include <tb_editor_internal.h>
|
||||
#include "tb_editor_image.h"
|
||||
|
||||
/* Helpers internos desta library (definidos mais abaixo) */
|
||||
|
||||
@@ -11,8 +11,10 @@ dark = [255, 51, 85, 255]
|
||||
bundle_members = ["tinyblocks-editor-widgets", "tinyblocks-editor-image", "tinyblocks-editor-files"]
|
||||
|
||||
[build]
|
||||
sources = ["src/tb_editor.c", "src/tb_stage_widget.c"]
|
||||
sources = ["src/tb_editor.c", "src/tb_stage_widget.c", "src/tb_editor_modules.c"]
|
||||
includes = ["include"]
|
||||
# tb_editor_internal.h, tb_editor_modules.h e tb_stage_widget.h sao API privada
|
||||
defines = ["TB_EDITOR_PRIVATE_API"]
|
||||
shared = "build/libtinyblocks-editor.so"
|
||||
static = "build/libtinyblocks-editor.a"
|
||||
depends = ["tinyblocks-editor-widgets", "tinyblocks-editor-image", "tinyblocks-editor-files"]
|
||||
@@ -46,7 +46,7 @@
|
||||
#include <tb_syntax.h>
|
||||
#include <tb_scratchblocks.h>
|
||||
#include <strings.h>
|
||||
#include "tb_stage_widget.h"
|
||||
#include <tb_stage_widget.h>
|
||||
#include "../include/tb_editor.h"
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ TB_API void tb_editor_preload(const char* path) {
|
||||
strncpy(s_preload[s_preload_n++], path, 511);
|
||||
}
|
||||
|
||||
#include "../internal/tb_editor_internal.h"
|
||||
#include <tb_editor_internal.h>
|
||||
|
||||
|
||||
/* Perninha (triangulo) do balao de previa, apontando para baixo.
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "../internal/tb_editor_internal.h"
|
||||
#include <tb_editor_internal.h>
|
||||
|
||||
/* Este arquivo nomeia os campos das tabelas (w.fill_rect, ...), entao os
|
||||
apelidos curtos do editor atrapalham: remove-os aqui. */
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include <tinyblocks/tb_stage.h>
|
||||
#include <tinyblocks/tb_renderable_block.h>
|
||||
#include <tb_graphics.h>
|
||||
#include "tb_stage_widget.h"
|
||||
#include <tb_stage_widget.h>
|
||||
|
||||
/* input 0 (opcional): Graphics.Input da janela que mostra o palco - da o tamanho da vista */
|
||||
static void eval_stage(TinyBlocks_Block* self, TinyBlocks* rt) {
|
||||
|
||||
Reference in new issue
Block a user