Entradas convertidas no core: fim dos helpers de conversão repetidos

- tb_block_input_text / _number / _integer / _truthy: a entrada do bloco
  já convertida, despachando pela classe do valor. O texto de um valor
  que não é texto fica em cache na conexão (sem buffers nos blocos).
- Saída com nome terminado em '?' vira o traço TB_SLOT_BOOLEAN na criação
  do tipo (a convenção mora num lugar só; o editor só lê traços).
- Removidas ~35 funções locais (in_text, in_real, in_int, num, as_num,
  input_name, value_num, value_truthy, value_to_str, item_text) em 22
  libraries e no editor. Inteiros que truncavam (coordenadas de pixel)
  continuam truncando; um número ligado a um campo de texto agora vira
  texto ("42") em vez de "".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mguinhosandClaude Opus 5.5 committed 2026-10-22 18:59:14 -03:00
1 parent a5e36b3eed
commit 5ffc1741c2
27 files changed
+217 -416

No files matched your search

+2 -6
View File
@@ -90,20 +90,16 @@ char* tb_base64_decode_str(const char* s, size_t* out_len) {
/* -- Blocos -------------------------------------------------------------- */
static const char* in_text(TinyBlocks_Block* self, TinyBlocks* rt, uint32_t i) {
TinyBlocks_Value v = tb_block_get_input(self, rt, i);
return (v.kind == TB_VALUE_TEXT && v.as.text) ? v.as.text : "";
}
static void eval_encode(TinyBlocks_Block* self, TinyBlocks* rt) {
char* s = tb_base64_encode_str(in_text(self, rt, 0));
char* s = tb_base64_encode_str(tb_block_input_text(self, rt, 0));
tb_block_set_output(self, 0, tb_value_text(s ? s : ""));
free(s);
self->dirty = false;
}
static void eval_decode(TinyBlocks_Block* self, TinyBlocks* rt) {
char* s = tb_base64_decode_str(in_text(self, rt, 0), NULL);
char* s = tb_base64_decode_str(tb_block_input_text(self, rt, 0), NULL);
tb_block_set_output(self, 0, tb_value_text(s ? s : ""));
free(s);
self->dirty = false;