Converte símbolos Unicode decorativos dos comentários para ASCII

Substitui barras de caixa (─ ═ │ ┌ ┐ └ ┘ ├ ┤ ┬ ┴), travessões (—),
setas (→ ←), reticências (…), bullets (•), multiplicação (×) e
guillemets (› ‹) por equivalentes ASCII. Acentos portugueses são
preservados.
This commit is contained in:
mguinhos committed 2026-10-20 19:27:33 -03:00
1 parent 1cc0ff9d02
commit 90d47bf8a0
36 files changed
+327 -327

No files matched your search

+12 -12
View File
@@ -2,7 +2,7 @@
#include <stdio.h>
#include "tinyblocks/tinyblocks.h"
/* ── Alocação da estrutura base ──────────────────────────────────────────── */
/* -- Alocação da estrutura base --- */
TinyBlocks_Block* tb_block_alloc_base(TinyBlocks* rt,
TinyBlocks_BlockKind kind,
size_t struct_size,
@@ -33,7 +33,7 @@ TinyBlocks_Block* tb_block_alloc_base(TinyBlocks* rt,
return b;
}
/* ── Vtable padrão para blocos definidos por TypeBlock ───────────────────── */
/* -- Vtable padrão para blocos definidos por TypeBlock --- */
static void default_eval(TinyBlocks_Block* self, TinyBlocks* rt)
{
if (self->type && self->type->eval_fn)
@@ -80,7 +80,7 @@ static const TinyBlocks_BlockVTable s_default_vtable = {
.clone = default_clone,
};
/* ── Criação via TypeBlock ───────────────────────────────────────────────── */
/* -- Criação via TypeBlock --- */
TinyBlocks_Block* tb_block_create(TinyBlocks* rt, TinyBlocks_TypeBlock* type)
{
if (!type) {
@@ -115,7 +115,7 @@ TinyBlocks_Block* tb_block_create(TinyBlocks* rt, TinyBlocks_TypeBlock* type)
return b;
}
/* ── Destruição ──────────────────────────────────────────────────────────── */
/* -- Destruição --- */
void tb_block_destroy(TinyBlocks_Block* block, TinyBlocks* rt)
{
if (!block) return;
@@ -138,14 +138,14 @@ void tb_block_destroy(TinyBlocks_Block* block, TinyBlocks* rt)
tb_free(rt, block);
}
/* ── Avaliação ───────────────────────────────────────────────────────────── */
/* -- Avaliação --- */
void tb_block_eval(TinyBlocks_Block* block, TinyBlocks* rt)
{
if (!block || !block->vtable || !block->vtable->eval) return;
/* Detecta ciclo: bloco já está sendo avaliado nesta chamada recursiva */
if (block->in_eval) {
tinyblocks_set_error(rt, "ciclo detectado em '%s' — conexão ignorada",
tinyblocks_set_error(rt, "ciclo detectado em '%s' - conexão ignorada",
block->type ? block->type->type_name : "?");
return;
}
@@ -162,14 +162,14 @@ void tb_block_eval(TinyBlocks_Block* block, TinyBlocks* rt)
block->in_eval = false;
}
/* ── Clone ───────────────────────────────────────────────────────────────── */
/* -- Clone --- */
TinyBlocks_Block* tb_block_clone(const TinyBlocks_Block* block, TinyBlocks* rt)
{
if (!block || !block->vtable || !block->vtable->clone) return NULL;
return block->vtable->clone(block, rt);
}
/* ── Representação textual ───────────────────────────────────────────────── */
/* -- Representação textual --- */
size_t tb_block_to_string(TinyBlocks_Block* block, TinyBlocks* rt,
char* buf, size_t buf_size)
{
@@ -180,7 +180,7 @@ size_t tb_block_to_string(TinyBlocks_Block* block, TinyBlocks* rt,
(unsigned long long)block->id);
}
/* ── Conexões ────────────────────────────────────────────────────────────── */
/* -- Conexões --- */
bool tb_block_connect(TinyBlocks_Block* target, uint32_t input_idx,
TinyBlocks_Block* source, uint32_t output_idx)
{
@@ -210,7 +210,7 @@ bool tb_block_set_default(TinyBlocks_Block* target, uint32_t input_idx,
return true;
}
/* ── Acesso a valores em eval_fn ─────────────────────────────────────────── */
/* -- Acesso a valores em eval_fn --- */
TinyBlocks_Value tb_block_get_input(TinyBlocks_Block* self, TinyBlocks* rt,
uint32_t input_idx)
{
@@ -225,7 +225,7 @@ TinyBlocks_Value tb_block_get_input(TinyBlocks_Block* self, TinyBlocks* rt,
return conn->default_value;
}
/* Toma ownership de v — o caller NÃO deve liberar v depois desta chamada.
/* Toma ownership de v - o caller NÃO deve liberar v depois desta chamada.
Se precisar manter v, passe tb_value_clone(v) em vez de v. */
void tb_block_set_output(TinyBlocks_Block* self, uint32_t output_idx,
TinyBlocks_Value v)
@@ -235,7 +235,7 @@ void tb_block_set_output(TinyBlocks_Block* self, uint32_t output_idx,
self->outputs[output_idx] = v;
}
/* ── Downcasting seguro ──────────────────────────────────────────────────── */
/* -- Downcasting seguro --- */
TinyBlocks_TypeBlock* tb_block_as_type (TinyBlocks_Block* b)
{ return b && b->kind == TB_KIND_TYPE ? (TinyBlocks_TypeBlock*)b : NULL; }
+3 -3
View File
@@ -1,7 +1,7 @@
#include <stdio.h>
#include "tinyblocks/tinyblocks.h"
/* ── Vtable ──────────────────────────────────────────────────────────────── */
/* -- Vtable --- */
static void integer_eval(TinyBlocks_Block* self, TinyBlocks* rt)
{
(void)rt;
@@ -38,7 +38,7 @@ static const TinyBlocks_BlockVTable s_integer_vtable = {
.clone = integer_clone,
};
/* ── Ciclo de vida ───────────────────────────────────────────────────────── */
/* -- Ciclo de vida --- */
TinyBlocks_IntegerBlock* tb_integer_block_create(TinyBlocks* rt, int64_t value)
{
TinyBlocks_IntegerBlock* ib = (TinyBlocks_IntegerBlock*)tb_block_alloc_base(
@@ -54,7 +54,7 @@ void tb_integer_block_destroy(TinyBlocks_IntegerBlock* ib, TinyBlocks* rt)
tb_block_destroy(&ib->base, rt);
}
/* ── Acesso ──────────────────────────────────────────────────────────────── */
/* -- Acesso --- */
int64_t tb_integer_block_get(const TinyBlocks_IntegerBlock* ib)
{
return ib ? ib->value : 0;
+14 -14
View File
@@ -26,9 +26,9 @@ struct TinyBlocks_JsonValue {
} as;
};
/* ══════════════════════════════════════════════════════════════════════════
/* ===
* Construtores / ciclo de vida
* ══════════════════════════════════════════════════════════════════════════ */
* === */
static TinyBlocks_JsonValue* json_alloc(TinyBlocks_JsonKind kind) {
TinyBlocks_JsonValue* j = calloc(1, sizeof(TinyBlocks_JsonValue));
if (!j) return NULL;
@@ -125,9 +125,9 @@ TinyBlocks_JsonValue* tb_json_clone(const TinyBlocks_JsonValue* j) {
return tb_json_null();
}
/* ══════════════════════════════════════════════════════════════════════════
/* ===
* Inspeção
* ══════════════════════════════════════════════════════════════════════════ */
* === */
TinyBlocks_JsonKind tb_json_kind(const TinyBlocks_JsonValue* j) {
return j ? j->kind : TB_JSON_NULL;
}
@@ -163,9 +163,9 @@ const char* tb_json_as_string(const TinyBlocks_JsonValue* j) {
return j->as.string;
}
/* ══════════════════════════════════════════════════════════════════════════
/* ===
* Arrays
* ══════════════════════════════════════════════════════════════════════════ */
* === */
bool tb_json_array_push(TinyBlocks_JsonValue* arr, TinyBlocks_JsonValue* item) {
if (!arr || arr->kind != TB_JSON_ARRAY || !item) return false;
if (arr->as.array.count == arr->as.array.capacity) {
@@ -191,9 +191,9 @@ TinyBlocks_JsonValue* tb_json_array_get(const TinyBlocks_JsonValue* arr, uint32_
return v;
}
/* ══════════════════════════════════════════════════════════════════════════
/* ===
* Objetos
* ══════════════════════════════════════════════════════════════════════════ */
* === */
bool tb_json_object_set(TinyBlocks_JsonValue* obj, const char* key, TinyBlocks_JsonValue* val) {
if (!obj || obj->kind != TB_JSON_OBJECT || !key || !val) return false;
for (uint32_t i = 0; i < obj->as.object.count; i++) {
@@ -240,9 +240,9 @@ TinyBlocks_JsonValue* tb_json_object_get(const TinyBlocks_JsonValue* obj, const
return NULL;
}
/* ══════════════════════════════════════════════════════════════════════════
/* ===
* Parser (recursive-descent, RFC 8259 simplificado)
* ══════════════════════════════════════════════════════════════════════════ */
* === */
typedef struct { const char* p; const char* end; char* err; size_t errcap; } JsonParser;
static void parser_fail(JsonParser* ps, const char* msg) {
@@ -425,9 +425,9 @@ TinyBlocks_JsonValue* tb_json_parse(const char* text, char* errbuf, size_t errbu
return v;
}
/* ══════════════════════════════════════════════════════════════════════════
/* ===
* Stringify
* ══════════════════════════════════════════════════════════════════════════ */
* === */
typedef struct { char* buf; size_t len, cap; } StrBuf;
static void sb_ensure(StrBuf* sb, size_t extra) {
@@ -512,9 +512,9 @@ char* tb_json_stringify(const TinyBlocks_JsonValue* j) {
return sb.buf;
}
/* ══════════════════════════════════════════════════════════════════════════
/* ===
* Helpers para TinyBlocks_Value
* ══════════════════════════════════════════════════════════════════════════ */
* === */
TinyBlocks_Value tb_value_json(TinyBlocks_JsonValue* j) {
TinyBlocks_Value v = { .kind = TB_VALUE_JSON, .as.json = j };
if (j) tb_json_retain(j);
+3 -3
View File
@@ -1,7 +1,7 @@
#include <stdio.h>
#include "tinyblocks/tinyblocks.h"
/* ── Vtable ──────────────────────────────────────────────────────────────── */
/* -- Vtable --- */
static void real_eval(TinyBlocks_Block* self, TinyBlocks* rt)
{
(void)rt;
@@ -38,7 +38,7 @@ static const TinyBlocks_BlockVTable s_real_vtable = {
.clone = real_clone,
};
/* ── Ciclo de vida ───────────────────────────────────────────────────────── */
/* -- Ciclo de vida --- */
TinyBlocks_RealBlock* tb_real_block_create(TinyBlocks* rt, double value)
{
TinyBlocks_RealBlock* rb = (TinyBlocks_RealBlock*)tb_block_alloc_base(
@@ -54,7 +54,7 @@ void tb_real_block_destroy(TinyBlocks_RealBlock* rb, TinyBlocks* rt)
tb_block_destroy(&rb->base, rt);
}
/* ── Acesso ──────────────────────────────────────────────────────────────── */
/* -- Acesso --- */
double tb_real_block_get(const TinyBlocks_RealBlock* rb)
{
return rb ? rb->value : 0.0;
+3 -3
View File
@@ -3,7 +3,7 @@
#include <stddef.h>
#include "tinyblocks/tb_renderable_block.h"
/* ── Pool estático — 4 frames em paralelo é suficiente para qualquer backend ─ */
/* -- Pool estático - 4 frames em paralelo é suficiente para qualquer backend - */
#define POOL_CAP 4
static TinyBlocks_RenderableBlock s_pool[POOL_CAP];
@@ -31,7 +31,7 @@ void tb_renderable_release_all(void) {
s_used[i] = false;
}
/* ── Append interno ─────────────────────────────────────────────────────────── */
/* -- Append interno --- */
static TinyBlocks_DrawCmd* append(TinyBlocks_RenderableBlock* rb) {
if (!rb || rb->count >= TB_DRAW_CMD_CAP) return NULL;
TinyBlocks_DrawCmd* c = &rb->cmds[rb->count++];
@@ -39,7 +39,7 @@ static TinyBlocks_DrawCmd* append(TinyBlocks_RenderableBlock* rb) {
return c;
}
/* ── Helpers públicos ────────────────────────────────────────────────────────── */
/* -- Helpers públicos --- */
void tb_draw_clear(TinyBlocks_RenderableBlock* rb,
float r, float g, float b, float a) {
TinyBlocks_DrawCmd* c = append(rb); if (!c) return;
+3 -3
View File
@@ -5,7 +5,7 @@
#include <string.h>
#include "tinyblocks/tinyblocks.h"
/* ── Vtable ──────────────────────────────────────────────────────────────── */
/* -- Vtable --- */
static void text_eval(TinyBlocks_Block* self, TinyBlocks* rt)
{
(void)rt;
@@ -43,7 +43,7 @@ static const TinyBlocks_BlockVTable s_text_vtable = {
.clone = text_clone,
};
/* ── Ciclo de vida ───────────────────────────────────────────────────────── */
/* -- Ciclo de vida --- */
TinyBlocks_TextBlock* tb_text_block_create(TinyBlocks* rt, const char* value)
{
TinyBlocks_TextBlock* tb = (TinyBlocks_TextBlock*)tb_block_alloc_base(
@@ -59,7 +59,7 @@ void tb_text_block_destroy(TinyBlocks_TextBlock* tb, TinyBlocks* rt)
tb_block_destroy(&tb->base, rt);
}
/* ── Acesso ──────────────────────────────────────────────────────────────── */
/* -- Acesso --- */
const char* tb_text_block_get(const TinyBlocks_TextBlock* tb)
{
return tb ? tb->value : NULL;
+2 -2
View File
@@ -2,7 +2,7 @@
#include <stdio.h>
#include "tinyblocks/tinyblocks.h"
/* ── Vtable de TypeBlock ─────────────────────────────────────────────────── */
/* -- Vtable de TypeBlock --- */
static void type_eval(TinyBlocks_Block* self, TinyBlocks* rt)
{
/* Um TypeBlock em si não avalia; serve como fábrica/descritor */
@@ -48,7 +48,7 @@ static const TinyBlocks_BlockVTable s_type_vtable = {
.clone = type_clone,
};
/* ── Criação ─────────────────────────────────────────────────────────────── */
/* -- Criação --- */
TinyBlocks_TypeBlock* tb_type_block_create(
TinyBlocks* rt,
const char* type_name,
+9 -9
View File
@@ -4,9 +4,9 @@
#include <stdio.h>
#include "tinyblocks/tinyblocks.h"
/* ══════════════════════════════════════════════════════════════════════════
* TinyBlocks_VectorData — buffer de comandos ref-counted
* ══════════════════════════════════════════════════════════════════════════ */
/* ===
* TinyBlocks_VectorData - buffer de comandos ref-counted
* === */
TinyBlocks_VectorData* tb_vector_data_create(void) {
TinyBlocks_VectorData* v = malloc(sizeof(TinyBlocks_VectorData));
if (!v) return NULL;
@@ -48,7 +48,7 @@ bool tb_vector_data_push(TinyBlocks_VectorData* v, TinyBlocks_VCmd cmd) {
return true;
}
/* ── Construtores de conveniência ────────────────────────────────────────── */
/* -- Construtores de conveniência --- */
#define PUSH0(v,k) tb_vector_data_push(v, (TinyBlocks_VCmd){(k), {0}})
#define PUSH2(v,k,a,b) tb_vector_data_push(v, (TinyBlocks_VCmd){(k), {(a),(b)}})
#define PUSH4(v,k,a,b,c,d) tb_vector_data_push(v,(TinyBlocks_VCmd){(k),{(a),(b),(c),(d)}})
@@ -77,7 +77,7 @@ bool tb_vector_circle(TinyBlocks_VectorData* v, float cx, float cy, float radius
#undef PUSH4
#undef PUSH5
/* ── Value helpers ───────────────────────────────────────────────────────── */
/* -- Value helpers --- */
TinyBlocks_Value tb_value_vector(TinyBlocks_VectorData* v) {
TinyBlocks_Value val;
val.kind = TB_VALUE_VECTOR;
@@ -90,7 +90,7 @@ TinyBlocks_VectorData* tb_value_as_vector(TinyBlocks_Value v) {
return v.kind == TB_VALUE_VECTOR ? v.as.vector : NULL;
}
/* ── RenderableBlock play ────────────────────────────────────────────────── */
/* -- RenderableBlock play --- */
void tb_draw_ctx_play(TinyBlocks_RenderableBlock* rb, TinyBlocks_VectorData* v) {
if (!rb || !v) return;
float px = 0.f, py = 0.f; /* ponto atual do path */
@@ -128,9 +128,9 @@ void tb_draw_ctx_play(TinyBlocks_RenderableBlock* rb, TinyBlocks_VectorData* v)
}
}
/* ══════════════════════════════════════════════════════════════════════════
* TinyBlocks_VectorBlock — block kind TB_KIND_VECTOR
* ══════════════════════════════════════════════════════════════════════════ */
/* ===
* TinyBlocks_VectorBlock - block kind TB_KIND_VECTOR
* === */
static void vec_eval(TinyBlocks_Block* self, TinyBlocks* rt) {
(void)rt;
TinyBlocks_VectorBlock* vb = (TinyBlocks_VectorBlock*)self;
+8 -8
View File
@@ -5,11 +5,11 @@
#include <stdarg.h>
#include "tinyblocks/tinyblocks.h"
/* ── Alocador padrão ─────────────────────────────────────────────────────── */
/* -- Alocador padrão --- */
static void* default_alloc(size_t size, void* ud) { (void)ud; return malloc(size); }
static void default_free (void* ptr, void* ud) { (void)ud; free(ptr); }
/* ── Inicialização ───────────────────────────────────────────────────────── */
/* -- Inicialização --- */
bool tinyblocks_init(TinyBlocks** out_rt, const TinyBlocks_InitOptions* opts)
{
if (!out_rt) return false;
@@ -54,7 +54,7 @@ bool tinyblocks_init(TinyBlocks** out_rt, const TinyBlocks_InitOptions* opts)
return true;
}
/* ── Desinicialização ────────────────────────────────────────────────────── */
/* -- Desinicialização --- */
void tinyblocks_deinit(TinyBlocks** rt_ptr)
{
if (!rt_ptr || !*rt_ptr) return;
@@ -109,7 +109,7 @@ void tinyblocks_deinit(TinyBlocks** rt_ptr)
*rt_ptr = NULL;
}
/* ── Alocação ────────────────────────────────────────────────────────────── */
/* -- Alocação --- */
void* tb_alloc(TinyBlocks* rt, size_t size)
{
void* p = rt->alloc(size, rt->alloc_userdata);
@@ -131,10 +131,10 @@ char* tb_strdup(TinyBlocks* rt, const char* str)
return p;
}
/* ── Geração de ID ───────────────────────────────────────────────────────── */
/* -- Geração de ID --- */
uint64_t tb_rt_next_id(TinyBlocks* rt) { return rt->next_id++; }
/* ── Registro de blocos ──────────────────────────────────────────────────── */
/* -- Registro de blocos --- */
static bool grow_array(TinyBlocks* rt, void*** arr, uint32_t* cap, uint32_t count)
{
if (count < *cap) return true;
@@ -202,7 +202,7 @@ void tb_rt_unregister_library(TinyBlocks* rt, TinyBlocks_LibraryBlock* lib)
}
}
/* ── Busca ───────────────────────────────────────────────────────────────── */
/* -- Busca --- */
TinyBlocks_Block* tb_rt_find_block(TinyBlocks* rt, uint64_t id)
{
for (uint32_t i = 0; i < rt->block_count; ++i)
@@ -227,7 +227,7 @@ TinyBlocks_LibraryBlock* tb_rt_find_library(TinyBlocks* rt, const char* name)
return NULL;
}
/* ── Erros ───────────────────────────────────────────────────────────────── */
/* -- Erros --- */
const char* tinyblocks_last_error(TinyBlocks* rt) { return rt->error; }
void tinyblocks_clear_error(TinyBlocks* rt) { rt->error[0] = '\0'; }