Tipo diz o texto do seu bloco-handle; paleta sem teto de 192 itens
value_text no TypeBlock: um bloco-handle (TB_VALUE_BLOCK) aparece como
a library quiser ("tensor [3, 32, 32]") em vez de "[bloco Tipo]".
fly_items vira vetor que cresce: as libraries de categoria ja ocupavam
185 dos 192 itens e as variaveis empurravam categorias inteiras para fora.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
34c9a39c2c
commit
3dd132d12d
6 files changed
+52
-9
No files matched your search
@@ -49,6 +49,7 @@ static TinyBlocks_Block* type_clone(const TinyBlocks_Block* self, TinyBlocks* rt
|
||||
t->lazy_inputs = src->lazy_inputs;
|
||||
t->label = src->label;
|
||||
t->label_defaults = src->label_defaults;
|
||||
t->value_text = src->value_text;
|
||||
for (uint32_t i = 0; i < src->input_desc_count; i++)
|
||||
tb_type_block_set_input_flags(t, i, tb_type_block_input_flags(src, i));
|
||||
for (uint32_t i = 0; i < src->output_desc_count; i++)
|
||||
@@ -82,6 +83,12 @@ void tb_type_block_set_pure(TinyBlocks_TypeBlock* tb, int pure, double (*num)(co
|
||||
tb->pure_arity = arity;
|
||||
}
|
||||
|
||||
void tb_type_block_set_value_text(TinyBlocks_TypeBlock* tb,
|
||||
size_t (*fn)(TinyBlocks_Block* self, char* out, size_t cap))
|
||||
{
|
||||
if (tb) tb->value_text = fn;
|
||||
}
|
||||
|
||||
void tb_type_block_set_input_flags(TinyBlocks_TypeBlock* tb, uint32_t i, uint32_t flags)
|
||||
{ if (tb && tb->input_flags && i < tb->input_desc_count) tb->input_flags[i] = flags; }
|
||||
void tb_type_block_set_output_flags(TinyBlocks_TypeBlock* tb, uint32_t i, uint32_t flags)
|
||||
|
||||
@@ -153,6 +153,8 @@ static const TinyBlocks_ValueClass s_text = {
|
||||
|
||||
static size_t block_text(TinyBlocks_Value v, char* out, size_t cap)
|
||||
{
|
||||
if (v.as.block && v.as.block->type && v.as.block->type->value_text)
|
||||
return v.as.block->type->value_text(v.as.block, out, cap);
|
||||
const char* n = v.as.block && v.as.block->type ? v.as.block->type->type_name : "?";
|
||||
return (size_t)snprintf(out, cap, "[bloco %s]", n);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user