diff --git a/include/tinyblocks/tb_image.h b/include/tinyblocks/tb_image.h index a76c620..d1634c7 100644 --- a/include/tinyblocks/tb_image.h +++ b/include/tinyblocks/tb_image.h @@ -45,7 +45,7 @@ TB_API int tb_image_format_count(void); TB_API TinyBlocks_Image* tb_image_load(const char* path); TB_API bool tb_image_save(const TinyBlocks_Image* img, const char* path); -/* -- Armazem de imagens nomeadas (usado pelos blocos "desenhe imagem") ---- +/* -- Armazem de imagens nomeadas (usado pelos blocos "desenhe imagem") --- * Uma imagem carregada ganha um NOME (ex: "c0bot" e "c0bot.png") e um NUMERO * (1, 2, 3... na ordem em que entrou). O armazem mantem uma referencia, entao * o palco pode desenhar a imagem depois sem se preocupar com a memoria. */ diff --git a/libraries/tinyblocks-api/src/tb_api.c b/libraries/tinyblocks-api/src/tb_api.c index 218d766..9dbed84 100644 --- a/libraries/tinyblocks-api/src/tb_api.c +++ b/libraries/tinyblocks-api/src/tb_api.c @@ -43,7 +43,7 @@ static const char* path_basename(const char* p) { return s ? s + 1 : p; } -/* -- Modulos de codigo (bundle) e watcher de arquivos ------------------- */ +/* -- Modulos de codigo (bundle) e watcher de arquivos --- */ typedef struct { char name[64]; @@ -416,7 +416,7 @@ bool tb_api_reload(int idx) { return tb_api_load(path) >= 0; } -/* -- Descoberta de libraries no disco ---------------------------------- */ +/* -- Descoberta de libraries no disco --- */ static bool try_path(const char* dir, const char* file, char* out, size_t cap) { if (!dir || !dir[0]) return false; diff --git a/libraries/tinyblocks-base64/src/tb_base64.c b/libraries/tinyblocks-base64/src/tb_base64.c index 769fb3a..3d8d241 100644 --- a/libraries/tinyblocks-base64/src/tb_base64.c +++ b/libraries/tinyblocks-base64/src/tb_base64.c @@ -88,7 +88,7 @@ char* tb_base64_decode_str(const char* s, size_t* out_len) { return (char*)tb_base64_decode(s, out_len); } -/* -- Blocos -------------------------------------------------------------- */ +/* -- Blocos --- */ static void eval_encode(TinyBlocks_Block* self, TinyBlocks* rt) { @@ -105,7 +105,7 @@ static void eval_decode(TinyBlocks_Block* self, TinyBlocks* rt) { self->dirty = false; } -/* -- Registro ------------------------------------------------------------ */ +/* -- Registro --- */ static bool reg(TinyBlocks* rt, TinyBlocks_LibraryBlock* lib, const char* name, const TinyBlocks_SlotDesc* in, uint32_t ni, diff --git a/libraries/tinyblocks-blueprint/src/serialize.c b/libraries/tinyblocks-blueprint/src/serialize.c index 90edd1f..432708f 100644 --- a/libraries/tinyblocks-blueprint/src/serialize.c +++ b/libraries/tinyblocks-blueprint/src/serialize.c @@ -545,7 +545,7 @@ static TinyBlocks_JsonValue* blueprint_csv_tree(const TbBlueprint* bp) { return arr; } -/* -- Formatos (TbBpFormat) ------------------------------------------------ */ +/* -- Formatos (TbBpFormat) --- */ static char* buf_take(Buf* b) { if (!b->p) { b->p = (char*)malloc(1); if (b->p) b->p[0] = 0; } diff --git a/libraries/tinyblocks-bmp/src/tb_bmp.c b/libraries/tinyblocks-bmp/src/tb_bmp.c index 5d7ed90..a22bc2d 100644 --- a/libraries/tinyblocks-bmp/src/tb_bmp.c +++ b/libraries/tinyblocks-bmp/src/tb_bmp.c @@ -121,7 +121,7 @@ bool tb_bmp_save(const TinyBlocks_Image* img, const char* path) { return ok; } -/* -- Blocos -------------------------------------------------------------- */ +/* -- Blocos --- */ static TinyBlocks_Image* in_img(TinyBlocks_Block* self, TinyBlocks* rt, uint32_t i) { TinyBlocks_Value v = tb_block_get_input(self, rt, i); diff --git a/libraries/tinyblocks-control/src/tb_control.c b/libraries/tinyblocks-control/src/tb_control.c index 3a3df74..6f90cfc 100644 --- a/libraries/tinyblocks-control/src/tb_control.c +++ b/libraries/tinyblocks-control/src/tb_control.c @@ -12,7 +12,7 @@ static void eval_noop(TinyBlocks_Block* self, TinyBlocks* rt) { self->dirty = false; } -/* -- Fluxos ------------------------------------------------------------------ +/* -- Fluxos --- * step: 0 = entrando, 1 = vai testar/entrar na volta, 2 = a volta acabou * (pausa um quadro, como no Scratch, e testa de novo). */ @@ -53,7 +53,7 @@ static const TinyBlocks_FlowClass s_forever = { 1, { NULL }, true, forever_n static const TinyBlocks_FlowClass s_if = { 1, { NULL }, false, if_next, NULL }; static const TinyBlocks_FlowClass s_if_else = { 2, { "senão" }, false, if_else_next, NULL }; -/* -- Registro ------------------------------------------------------------- */ +/* -- Registro --- */ static bool reg(TinyBlocks* rt, TinyBlocks_LibraryBlock* lib, const char* name, const TinyBlocks_SlotDesc* in, uint32_t ni, diff --git a/libraries/tinyblocks-curves/src/tb_curves.c b/libraries/tinyblocks-curves/src/tb_curves.c index d712c80..08d17b3 100644 --- a/libraries/tinyblocks-curves/src/tb_curves.c +++ b/libraries/tinyblocks-curves/src/tb_curves.c @@ -40,7 +40,7 @@ static void push_point(TinyBlocks_JsonValue* arr, double x, double y) { tb_json_release(pt); } -/* -- Curvas -------------------------------------------------------------- */ +/* -- Curvas --- */ TinyBlocks_JsonValue* tb_curves_line(double x0, double y0, double x1, double y1, int steps) { @@ -104,7 +104,7 @@ TinyBlocks_JsonValue* tb_curves_circle(double cx, double cy, double r, int steps return tb_curves_arc(cx, cy, r, 0.0, 360.0, steps); } -/* -- Leitura ------------------------------------------------------------- */ +/* -- Leitura --- */ int tb_curves_count(const TinyBlocks_JsonValue* pts) { if (!pts || tb_json_kind(pts) != TB_JSON_ARRAY) return 0; @@ -128,7 +128,7 @@ bool tb_curves_point(const TinyBlocks_JsonValue* pts, int i, double* x, double* return ok; } -/* -- Helpers de entrada -------------------------------------------------- */ +/* -- Helpers de entrada --- */ static int64_t in_int(TinyBlocks_Block* self, TinyBlocks* rt, uint32_t i) { @@ -149,7 +149,7 @@ static void out_pts(TinyBlocks_Block* self, TinyBlocks_JsonValue* pts) { self->dirty = false; } -/* -- Blocos -------------------------------------------------------------- */ +/* -- Blocos --- */ static void eval_line(TinyBlocks_Block* self, TinyBlocks* rt) { out_pts(self, tb_curves_line(tb_block_input_number(self,rt,0, 0), tb_block_input_number(self,rt,1, 0), @@ -195,7 +195,7 @@ static void eval_pointy(TinyBlocks_Block* self, TinyBlocks* rt) { self->dirty = false; } -/* -- Registro ------------------------------------------------------------ */ +/* -- Registro --- */ static bool reg(TinyBlocks* rt, TinyBlocks_LibraryBlock* lib, const char* name, const TinyBlocks_SlotDesc* in, uint32_t ni, diff --git a/libraries/tinyblocks-editor/libraries/tinyblocks-editor-files/src/tb_editor_files.c b/libraries/tinyblocks-editor/libraries/tinyblocks-editor-files/src/tb_editor_files.c index d1362c9..72bd5d1 100644 --- a/libraries/tinyblocks-editor/libraries/tinyblocks-editor-files/src/tb_editor_files.c +++ b/libraries/tinyblocks-editor/libraries/tinyblocks-editor-files/src/tb_editor_files.c @@ -19,7 +19,7 @@ #include #include "tb_editor_files.h" -/* -- Geometria ------------------------------------------------------------ */ +/* -- Geometria --- */ #define FD_HEAD_H 46 #define FD_BAR_H 44 #define FD_SIDE_W 196 @@ -87,7 +87,7 @@ static void fd_layout(Ed* ed, FdL* L) { L->cancel_x = L->ok_x - 10.f - FD_BTN_W; } -/* -- Utilidades ----------------------------------------------------------- */ +/* -- Utilidades --- */ static unsigned fd_now_ms(void) { struct timespec ts; @@ -213,7 +213,7 @@ static void fd_time_str(char* out, size_t cap, long long t) { strftime(out, cap, "%d/%m/%Y %H:%M", &tmv); } -/* -- Listagem ------------------------------------------------------------- */ +/* -- Listagem --- */ static int fd_cmp(const void* a, const void* b) { const FileEnt* x = a; @@ -346,7 +346,7 @@ static void fd_places(Ed* ed) { fd_add_place(F, "Raiz do sistema", "/"); } -/* -- Trilha da pasta atual (segmentos clicaveis) ------------------------- */ +/* -- Trilha da pasta atual (segmentos clicaveis) --- */ #define FD_MAX_CRUMBS 48 typedef struct { int n, first; /* segmentos; primeiro visivel */ @@ -400,7 +400,7 @@ static void fd_crumbs(Ed* ed, const FdL* L, FdCrumbs* K) { } } -/* -- Acoes ---------------------------------------------------------------- */ +/* -- Acoes --- */ static void fd_ensure_visible(Ed* ed) { FileDlg* F = &ed->fdlg; @@ -549,7 +549,7 @@ void tb_editor_files_open(Ed* ed, int mode, const char* def) { fd_ensure_visible(ed); } -/* -- Desenho -------------------------------------------------------------- */ +/* -- Desenho --- */ static void fd_icon_folder(TinyBlocks_RenderableBlock* rb, float x, float y, bool dim) { Col c = COL_FD_FOLDER, d = COL_FD_FOLDER_DARK; @@ -797,7 +797,7 @@ void tb_editor_files_view(Ed* ed, TinyBlocks_RenderableBlock* rb) { } } -/* -- Entrada -------------------------------------------------------------- */ +/* -- Entrada --- */ static void fd_rescan_keep(Ed* ed) { FileDlg* F = &ed->fdlg; diff --git a/libraries/tinyblocks-editor/libraries/tinyblocks-editor-image/src/tb_editor_image.c b/libraries/tinyblocks-editor/libraries/tinyblocks-editor-image/src/tb_editor_image.c index 7d89153..385ff1b 100644 --- a/libraries/tinyblocks-editor/libraries/tinyblocks-editor-image/src/tb_editor_image.c +++ b/libraries/tinyblocks-editor/libraries/tinyblocks-editor-image/src/tb_editor_image.c @@ -53,7 +53,7 @@ static const Col IMG_PALETTE[12] = { {0.55f,0.38f,0.24f,1.f}, {0.60f,0.60f,0.60f,1.f} }; -/* Cor: HSV (roda de matiz + quadrado saturacao/valor) ------------------- */ +/* Cor: HSV (roda de matiz + quadrado saturacao/valor) --- */ static Col img_hsv_col(float h, float sat, float v) { float c = v * sat; float hp = h / 60.f; @@ -95,7 +95,7 @@ static void img_hsv_apply(Tab* T) { T->img_swatch = -1; } -/* Geometria ------------------------------------------------------------- +/* Geometria --- * Layout (como no Krita): ferramentas na coluna da esquerda, tela no meio e * na direita uma coluna com a roda de cores em cima e as camadas embaixo. */ #define IMG_TOOL_W 54 /* coluna de ferramentas (esquerda) */ @@ -248,7 +248,7 @@ static void img_side_btn(Ed* ed, int which, float* x, float* y, float* w, float* (void)ed; } -/* Camadas --------------------------------------------------------------- */ +/* Camadas --- */ #define IMG_THUMB_W 40 #define IMG_THUMB_H 30 /* Miniatura da camada (cacheada por revisao) - como no painel do Scratch */ @@ -383,7 +383,7 @@ static bool img_layer_add(Ed* ed, Tab* T, int kind, const char* src, const char* return true; } -/* Desenho --------------------------------------------------------------- */ +/* Desenho --- */ static bool img_pixel_at(Ed* ed, Tab* T, float mx, float my, int* px, int* py) { float dx, dy, dw, dh; img_view(ed, T, &dx, &dy, &dw, &dh); @@ -514,9 +514,9 @@ static void img_flatten(Tab* T, TinyBlocks_Image* dst) { } } -/* Miniatura do documento (cache; reconstruida so quando algo muda) -------- */ +/* Miniatura do documento (cache; reconstruida so quando algo muda) --- */ -/* Selecao: mover / redimensionar pixels ---------------------------------- */ +/* Selecao: mover / redimensionar pixels --- */ void tb_editor_image_sel_reset(Tab* T) { if (T->img_sel.buf) { tb_image_release(T->img_sel.buf); T->img_sel.buf = NULL; } memset(&T->img_sel, 0, sizeof(T->img_sel)); @@ -606,7 +606,7 @@ static void img_sel_resize(Tab* T, int hnd, int px, int py) { if (S->h < 1) S->h = 1; } -/* Undo ------------------------------------------------------------------ */ +/* Undo --- */ static void img_undo_push(Tab* T) { ImgLayer* L = img_active(T); if (!L || !L->img) return; @@ -636,7 +636,7 @@ static void img_undo_do(Tab* T) { T->img_rev++; } -/* Icones das ferramentas ------------------------------------------------ */ +/* Icones das ferramentas --- */ static void img_draw_icon(TinyBlocks_RenderableBlock* rb, int tool, float cx, float cy, Col c) { switch (tool) { case IT_SEL: @@ -672,7 +672,7 @@ static void img_draw_icon(TinyBlocks_RenderableBlock* rb, int tool, float cx, fl } } -/* Render ---------------------------------------------------------------- */ +/* Render --- */ void tb_editor_image_view(Ed* ed, TinyBlocks_RenderableBlock* rb) { Tab* T = &CT; img_ensure(ed, T); @@ -805,7 +805,7 @@ void tb_editor_image_view(Ed* ed, TinyBlocks_RenderableBlock* rb) { labels[i], enabled ? COL_TEXT : COL_TEXT_DIM, FS_UI - 1); } - /* ---- widget novo: slider de zoom ---- */ + /* --- widget novo: slider de zoom --- */ { float sx, sy, sw, sh; img_zoom_slider(ed, &sx, &sy, &sw, &sh); @@ -907,7 +907,7 @@ void tb_editor_image_view(Ed* ed, TinyBlocks_RenderableBlock* rb) { rb_text_c(rb, px + IMG_PAD, img_pal_y(ed) + 4 * 30 + 6, inf, COL_TEXT, FS_UI); } - /* ---- camadas: embaixo da roda de cores (como no Krita) ---- */ + /* --- camadas: embaixo da roda de cores (como no Krita) --- */ rb_line(rb, px + IMG_PAD, img_layers_title_y(ed) - 14, px + IMG_RIGHT_W - IMG_PAD, img_layers_title_y(ed) - 14, 1.f, COL_PAINT_LINE); rb_text_c(rb, px + IMG_PAD, img_layers_title_y(ed), "Camadas", COL_TEXT_DIM, 11.f); @@ -957,7 +957,7 @@ void tb_editor_image_view(Ed* ed, TinyBlocks_RenderableBlock* rb) { } } -/* Entrada --------------------------------------------------------------- */ +/* Entrada --- */ static void img_clear_layer(Tab* T) { ImgLayer* L = img_active(T); if (!L || !L->img) return; diff --git a/libraries/tinyblocks-editor/src/tb_editor_modules.c b/libraries/tinyblocks-editor/src/tb_editor_modules.c index 4da3c62..d988a2a 100644 --- a/libraries/tinyblocks-editor/src/tb_editor_modules.c +++ b/libraries/tinyblocks-editor/src/tb_editor_modules.c @@ -51,7 +51,7 @@ static char s_dir[512] = ""; const char* tb_ed_modules_dir(void) { return s_dir; } -/* -- utilidades ---------------------------------------------------------- */ +/* -- utilidades --- */ static bool file_exists(const char* p) { struct stat st; @@ -157,7 +157,7 @@ static bool resolve_files(void) { return ok; } -/* -- carga --------------------------------------------------------------- */ +/* -- carga --- */ bool tb_ed_modules_load(Ed* ed) { if (!tb_api_runtime()) tb_api_init(ed->rt); diff --git a/libraries/tinyblocks-environ/src/tb_environ.c b/libraries/tinyblocks-environ/src/tb_environ.c index 6ef87db..8086bd3 100644 --- a/libraries/tinyblocks-environ/src/tb_environ.c +++ b/libraries/tinyblocks-environ/src/tb_environ.c @@ -26,7 +26,7 @@ static EnvPair s_env[ENV_MAX]; static int s_env_n = 0; static char s_err[256] = ""; -/* -- Store --------------------------------------------------------------- */ +/* -- Store --- */ static char* dup_str(const char* s) { if (!s) s = ""; @@ -200,7 +200,7 @@ const char* tb_environ_env_path(void) { return (e && e[0]) ? e : ""; } -/* -- Blocos -------------------------------------------------------------- */ +/* -- Blocos --- */ static void eval_get(TinyBlocks_Block* self, TinyBlocks* rt) { @@ -223,7 +223,7 @@ static void eval_unset(TinyBlocks_Block* self, TinyBlocks* rt) { self->dirty = false; } -/* -- Registro ------------------------------------------------------------ */ +/* -- Registro --- */ static bool reg(TinyBlocks* rt, TinyBlocks_LibraryBlock* lib, const char* name, const TinyBlocks_SlotDesc* in, uint32_t ni, diff --git a/libraries/tinyblocks-errors/src/tb_errors.c b/libraries/tinyblocks-errors/src/tb_errors.c index 7fb39e5..966d619 100644 --- a/libraries/tinyblocks-errors/src/tb_errors.c +++ b/libraries/tinyblocks-errors/src/tb_errors.c @@ -11,7 +11,7 @@ #include #include "tb_errors.h" -/* -- Saidas --------------------------------------------------------------- */ +/* -- Saidas --- */ /* Toma a referencia de r */ static void out_result(TinyBlocks_Block* self, TinyBlocks_Result* r) { @@ -25,7 +25,7 @@ static void out_bool(TinyBlocks_Block* self, bool b) { self->dirty = false; } -/* -- Blocos: resultados --------------------------------------------------- */ +/* -- Blocos: resultados --- */ /* "tente obter (x)": avalia x (o tipo tem lazy_inputs); erro vira Erro(msg), valor vira Ok(valor) */ @@ -102,7 +102,7 @@ static void eval_message(TinyBlocks_Block* self, TinyBlocks* rt) { self->dirty = false; } -/* -- Blocos: tratamento --------------------------------------------------- */ +/* -- Blocos: tratamento --- */ /* "lance o erro [msg]" (raise / panic!) */ static void eval_raise(TinyBlocks_Block* self, TinyBlocks* rt) { @@ -124,7 +124,7 @@ static void eval_nop(TinyBlocks_Block* self, TinyBlocks* rt) { self->dirty = false; } -/* -- Fluxos: tente / se der erro / finalmente ------------------------------- +/* -- Fluxos: tente / se der erro / finalmente --- * step: 0 entrando, 1 no "tente", 2 no "se der erro", 3 no "finalmente". */ static void catch_enter(TinyBlocks_Flow* f, const char* msg) { @@ -182,7 +182,7 @@ static const TinyBlocks_FlowClass s_try_catch = { static const TinyBlocks_FlowClass s_try = { 3, { "se der erro", "finalmente" }, false, try_next, try_error }; -/* -- Registro ------------------------------------------------------------- */ +/* -- Registro --- */ static bool reg(TinyBlocks* rt, TinyBlocks_LibraryBlock* lib, const char* name, const TinyBlocks_SlotDesc* in, uint32_t ni, diff --git a/libraries/tinyblocks-fs/src/tb_fs.c b/libraries/tinyblocks-fs/src/tb_fs.c index cfe2ba2..e8481b5 100644 --- a/libraries/tinyblocks-fs/src/tb_fs.c +++ b/libraries/tinyblocks-fs/src/tb_fs.c @@ -108,7 +108,7 @@ static void eval_close(TinyBlocks_Block* self, TinyBlocks* rt) { self->dirty = false; } -/* -- Pastas --------------------------------------------------------------- */ +/* -- Pastas --- */ static int cmp_name(const void* a, const void* b) { return strcasecmp(*(char* const*)a, *(char* const*)b); @@ -206,7 +206,7 @@ static void eval_exists(TinyBlocks_Block* self, TinyBlocks* rt) { self->dirty = false; } -/* -- Registro ------------------------------------------------------------ */ +/* -- Registro --- */ static bool reg(TinyBlocks* rt, TinyBlocks_LibraryBlock* lib, const char* name, const TinyBlocks_SlotDesc* in, uint32_t ni, diff --git a/libraries/tinyblocks-image/src/tb_imglib.c b/libraries/tinyblocks-image/src/tb_imglib.c index b577d47..92d3897 100644 --- a/libraries/tinyblocks-image/src/tb_imglib.c +++ b/libraries/tinyblocks-image/src/tb_imglib.c @@ -77,7 +77,7 @@ TinyBlocks_Image* tb_imglib_scale(const TinyBlocks_Image* img, return out; } -/* -- Helpers de entrada -------------------------------------------------- */ +/* -- Helpers de entrada --- */ static TinyBlocks_Image* in_img(TinyBlocks_Block* self, TinyBlocks* rt, uint32_t i) { TinyBlocks_Value v = tb_block_get_input(self, rt, i); @@ -92,7 +92,7 @@ static void out_img(TinyBlocks_Block* self, TinyBlocks_Image* img) { self->dirty = false; } -/* -- Blocos -------------------------------------------------------------- */ +/* -- Blocos --- */ static void eval_new(TinyBlocks_Block* self, TinyBlocks* rt) { int w = (int)tb_block_input_number(self, rt, 0, 0), h = (int)tb_block_input_number(self, rt, 1, 0); @@ -155,7 +155,7 @@ static void eval_save(TinyBlocks_Block* self, TinyBlocks* rt) { self->dirty = false; } -/* -- Conversoes ---------------------------------------------------------- */ +/* -- Conversoes --- */ #define IMG_MAX_PIXELS (4096 * 4096) @@ -304,7 +304,7 @@ static void eval_to_text(TinyBlocks_Block* self, TinyBlocks* rt) { self->dirty = false; } -/* -- Registro ------------------------------------------------------------ */ +/* -- Registro --- */ static bool reg(TinyBlocks* rt, TinyBlocks_LibraryBlock* lib, const char* name, const TinyBlocks_SlotDesc* in, uint32_t ni, diff --git a/libraries/tinyblocks-input/src/tb_input.c b/libraries/tinyblocks-input/src/tb_input.c index 8e14c32..179cae8 100644 --- a/libraries/tinyblocks-input/src/tb_input.c +++ b/libraries/tinyblocks-input/src/tb_input.c @@ -22,7 +22,7 @@ #include #include "tb_input_lib.h" -/* -- Nomes de tecla ------------------------------------------------------- */ +/* -- Nomes de tecla --- */ typedef struct { const char* name; int key; } KeyName; @@ -89,7 +89,7 @@ TB_API const char* tb_input_key_name(int key) { return ""; } -/* -- Entradas/saidas ------------------------------------------------------ */ +/* -- Entradas/saidas --- */ @@ -117,7 +117,7 @@ static void out_bool(TinyBlocks_Block* self, bool b) { self->dirty = false; } -/* -- Blocos --------------------------------------------------------------- */ +/* -- Blocos --- */ static void eval_mouse_x(TinyBlocks_Block* self, TinyBlocks* rt) { (void)rt; out_num(self, roundf(tb_input_mouse_x())); } static void eval_mouse_y(TinyBlocks_Block* self, TinyBlocks* rt) { (void)rt; out_num(self, roundf(tb_input_mouse_y())); } @@ -172,7 +172,7 @@ static void eval_reset_timer(TinyBlocks_Block* self, TinyBlocks* rt) { self->dirty = false; } -/* -- Registro ------------------------------------------------------------- */ +/* -- Registro --- */ static bool reg(TinyBlocks* rt, TinyBlocks_LibraryBlock* lib, const char* name, const TinyBlocks_SlotDesc* in, uint32_t ni, diff --git a/libraries/tinyblocks-jpg/src/tb_jpg.c b/libraries/tinyblocks-jpg/src/tb_jpg.c index 48141f5..ddb6820 100644 --- a/libraries/tinyblocks-jpg/src/tb_jpg.c +++ b/libraries/tinyblocks-jpg/src/tb_jpg.c @@ -129,7 +129,7 @@ bool tb_jpg_save(const TinyBlocks_Image* img, const char* path, int quality) { return ok; } -/* -- Blocos -------------------------------------------------------------- */ +/* -- Blocos --- */ static TinyBlocks_Image* in_img(TinyBlocks_Block* self, TinyBlocks* rt, uint32_t i) { TinyBlocks_Value v = tb_block_get_input(self, rt, i); diff --git a/libraries/tinyblocks-markdown/include/tb_markdown.h b/libraries/tinyblocks-markdown/include/tb_markdown.h index 4999da8..a0633d7 100644 --- a/libraries/tinyblocks-markdown/include/tb_markdown.h +++ b/libraries/tinyblocks-markdown/include/tb_markdown.h @@ -10,7 +10,7 @@ TB_API const TinyBlocks_LibraryDescriptor* tb_markdown_get_library(void); -/* -- API C (resultados com malloc; libere com free) ---------------------- */ +/* -- API C (resultados com malloc; libere com free) --- */ TB_API char* tb_markdown_to_html(const char* md); TB_API char* tb_markdown_to_xml(const char* md); TB_API char* tb_markdown_to_svg(const char* md); diff --git a/libraries/tinyblocks-markdown/src/tb_markdown.c b/libraries/tinyblocks-markdown/src/tb_markdown.c index 3d97db2..4f7882b 100644 --- a/libraries/tinyblocks-markdown/src/tb_markdown.c +++ b/libraries/tinyblocks-markdown/src/tb_markdown.c @@ -18,7 +18,7 @@ static char s_err[160] = ""; const char* tb_markdown_last_error(void) { return s_err; } -/* ---------------------------------------------------------------- Buffer */ +/* --- Buffer */ typedef struct { char* p; size_t n, cap; } Buf; static bool b_res(Buf* b, size_t extra) { if (b->n + extra + 1 <= b->cap) return true; @@ -49,7 +49,7 @@ static void b_esc(Buf* b, const char* s, size_t n) { } } -/* ----------------------------------------------------------------- Blocos */ +/* --- Blocos */ typedef enum { BLK_H, BLK_P, BLK_LI, BLK_CODE, BLK_QUOTE, BLK_HR } BlkKind; typedef struct { BlkKind kind; @@ -208,7 +208,7 @@ static Doc* parse(const char* md) { return d; } -/* ---------------------------------------------------------------- Inline */ +/* --- Inline */ /* Serializa inline markdown para HTML (xml=false) ou XML (xml=true). */ static void inline_out(Buf* b, const char* s, bool xml) { const char* bold0 = xml ? "" : ""; @@ -276,7 +276,7 @@ static void inline_out(Buf* b, const char* s, bool xml) { } } -/* ------------------------------------------------------------------ HTML */ +/* --- HTML */ char* tb_markdown_to_html(const char* md) { s_err[0] = 0; Doc* d = parse(md); @@ -320,7 +320,7 @@ char* tb_markdown_to_html(const char* md) { return b.p; } -/* ------------------------------------------------------------------- XML */ +/* --- XML */ char* tb_markdown_to_xml(const char* md) { s_err[0] = 0; Doc* d = parse(md); @@ -367,7 +367,7 @@ char* tb_markdown_to_xml(const char* md) { return b.p; } -/* ------------------------------------------------------------------- SVG */ +/* --- SVG */ char* tb_markdown_to_svg_opts(const char* md, int width, int font_size) { s_err[0] = 0; if (width < 80) width = 640; @@ -470,7 +470,7 @@ char* tb_markdown_to_svg_opts(const char* md, int width, int font_size) { char* tb_markdown_to_svg(const char* md) { return tb_markdown_to_svg_opts(md, 640, 16); } -/* ---------------------------------------------------------------- Blocos */ +/* --- Blocos */ static void eval_html(TinyBlocks_Block* self, TinyBlocks* rt) { char* s = tb_markdown_to_html(tb_block_input_text(self, rt, 0)); tb_block_set_output(self, 0, tb_value_text(s ? s : "")); free(s); self->dirty = false; diff --git a/libraries/tinyblocks-number/src/tb_number.c b/libraries/tinyblocks-number/src/tb_number.c index a5bd16c..65498ab 100644 --- a/libraries/tinyblocks-number/src/tb_number.c +++ b/libraries/tinyblocks-number/src/tb_number.c @@ -26,7 +26,7 @@ #endif #define DEG (M_PI / 180.0) -/* -- API ------------------------------------------------------------------ */ +/* -- API --- */ TB_API double tb_number_round_to(double x, int places) { if (places < 0) places = 0; @@ -60,7 +60,7 @@ TB_API void tb_number_format(double x, int places, char* out, size_t cap) { } } -/* -- Entradas/saidas ------------------------------------------------------ */ +/* -- Entradas/saidas --- */ /* Inteiro quando o resultado for exato (e couber), senao real */ @@ -80,7 +80,7 @@ static void out_bool(TinyBlocks_Block* self, bool b) { /* trigonometria: corta o ruido de ponto flutuante (sen 180 = 0, nao 1e-16) */ static double trig(double x) { return tb_number_round_to(x, 10); } -/* -- Blocos --------------------------------------------------------------- */ +/* -- Blocos --- */ #define N(i) tb_block_input_number(self, rt, (i), 0) @@ -147,7 +147,7 @@ static void eval_is_int(TinyBlocks_Block* self, TinyBlocks* rt) { out_bool(self, isfinite(x) && x == floor(x)); } -/* -- Conversoes ----------------------------------------------------------- */ +/* -- Conversoes --- */ /* Texto -> numero: o mesmo do core (espacos nas pontas, virgula decimal) */ TB_API bool tb_number_parse(const char* s, double* out) { @@ -201,7 +201,7 @@ static void eval_from_base(TinyBlocks_Block* self, TinyBlocks* rt) { out_num(self, (double)r); } -/* -- Registro ------------------------------------------------------------- */ +/* -- Registro --- */ static bool reg(TinyBlocks* rt, TinyBlocks_LibraryBlock* lib, const char* name, const TinyBlocks_SlotDesc* in, uint32_t ni, diff --git a/libraries/tinyblocks-opentype/include/tb_opentype.h b/libraries/tinyblocks-opentype/include/tb_opentype.h index 5b428fd..f55f44e 100644 --- a/libraries/tinyblocks-opentype/include/tb_opentype.h +++ b/libraries/tinyblocks-opentype/include/tb_opentype.h @@ -16,7 +16,7 @@ TB_API const TinyBlocks_LibraryDescriptor* tb_opentype_get_library(void); -/* -- API C --------------------------------------------------------------- */ +/* -- API C --- */ /* Carrega uma fonte; devolve um handle (>0) ou 0 em erro. */ TB_API int tb_opentype_load(const char* path); diff --git a/libraries/tinyblocks-opentype/src/tb_opentype.c b/libraries/tinyblocks-opentype/src/tb_opentype.c index 8205a65..1d1a624 100644 --- a/libraries/tinyblocks-opentype/src/tb_opentype.c +++ b/libraries/tinyblocks-opentype/src/tb_opentype.c @@ -294,7 +294,7 @@ const char* tb_opentype_default_font(void) { return NULL; } -/* ---------------------------------------------------------------- Blocos */ +/* --- Blocos */ static void eval_load(TinyBlocks_Block* self, TinyBlocks* rt) { int h = tb_opentype_load(tb_block_input_text(self, rt, 0)); diff --git a/libraries/tinyblocks-os/src/tb_os.c b/libraries/tinyblocks-os/src/tb_os.c index 1659277..7b3e152 100644 --- a/libraries/tinyblocks-os/src/tb_os.c +++ b/libraries/tinyblocks-os/src/tb_os.c @@ -22,7 +22,7 @@ static void copy(char* out, size_t cap, const char* s) { snprintf(out, cap, "%s", s ? s : ""); } -/* -- Consultas ------------------------------------------------------------ */ +/* -- Consultas --- */ TB_API void tb_os_name(char* out, size_t cap) { #if defined(__APPLE__) @@ -104,7 +104,7 @@ TB_API long long tb_os_uptime_s(void) { return (long long)up; } -/* -- Blocos --------------------------------------------------------------- */ +/* -- Blocos --- */ static void out_text(TinyBlocks_Block* self, void (*fn)(char*, size_t)) { char buf[512]; @@ -170,7 +170,7 @@ static void eval_is(TinyBlocks_Block* self, TinyBlocks* rt) { self->dirty = false; } -/* -- Registro ------------------------------------------------------------- */ +/* -- Registro --- */ static bool reg(TinyBlocks* rt, TinyBlocks_LibraryBlock* lib, const char* name, const TinyBlocks_SlotDesc* in, uint32_t ni, diff --git a/libraries/tinyblocks-png/src/tb_png.c b/libraries/tinyblocks-png/src/tb_png.c index b5affc8..952c3b8 100644 --- a/libraries/tinyblocks-png/src/tb_png.c +++ b/libraries/tinyblocks-png/src/tb_png.c @@ -72,7 +72,7 @@ bool tb_png_save(const TinyBlocks_Image* img, const char* path) { return ok; } -/* -- Blocos -------------------------------------------------------------- */ +/* -- Blocos --- */ static TinyBlocks_Image* in_img(TinyBlocks_Block* self, TinyBlocks* rt, uint32_t i) { TinyBlocks_Value v = tb_block_get_input(self, rt, i); diff --git a/libraries/tinyblocks-ppm/src/tb_ppm.c b/libraries/tinyblocks-ppm/src/tb_ppm.c index 7e607c6..2b77f40 100644 --- a/libraries/tinyblocks-ppm/src/tb_ppm.c +++ b/libraries/tinyblocks-ppm/src/tb_ppm.c @@ -110,7 +110,7 @@ bool tb_ppm_save(const TinyBlocks_Image* img, const char* path) { return ok; } -/* -- Helpers de entrada -------------------------------------------------- */ +/* -- Helpers de entrada --- */ static TinyBlocks_Image* in_img(TinyBlocks_Block* self, TinyBlocks* rt, uint32_t i) { TinyBlocks_Value v = tb_block_get_input(self, rt, i); @@ -123,7 +123,7 @@ static uint8_t clamp8(double v) { return (uint8_t)(v + 0.5); } -/* -- Blocos -------------------------------------------------------------- */ +/* -- Blocos --- */ static void eval_load(TinyBlocks_Block* self, TinyBlocks* rt) { TinyBlocks_Image* img = tb_ppm_load(tb_block_input_text(self, rt, 0)); @@ -186,7 +186,7 @@ static void eval_getpixel(TinyBlocks_Block* self, TinyBlocks* rt) { self->dirty = false; } -/* -- Registro ------------------------------------------------------------ */ +/* -- Registro --- */ static bool reg(TinyBlocks* rt, TinyBlocks_LibraryBlock* lib, const char* name, const TinyBlocks_SlotDesc* in, uint32_t ni, diff --git a/libraries/tinyblocks-regex/include/tb_regex.h b/libraries/tinyblocks-regex/include/tb_regex.h index d7cd34c..882ebf6 100644 --- a/libraries/tinyblocks-regex/include/tb_regex.h +++ b/libraries/tinyblocks-regex/include/tb_regex.h @@ -10,7 +10,7 @@ TB_API const TinyBlocks_LibraryDescriptor* tb_regex_get_library(void); -/* -- API C --------------------------------------------------------------- */ +/* -- API C --- */ /* Verdadeiro se o padrao casa em algum ponto do texto. */ TB_API bool tb_regex_test(const char* text, const char* pattern); diff --git a/libraries/tinyblocks-regex/src/tb_regex.c b/libraries/tinyblocks-regex/src/tb_regex.c index 20d7ed5..ceac68b 100644 --- a/libraries/tinyblocks-regex/src/tb_regex.c +++ b/libraries/tinyblocks-regex/src/tb_regex.c @@ -107,7 +107,7 @@ int tb_regex_count(const char* text, const char* pattern) { return count; } -/* --- Expansao do substituto -------------------------------------------- */ +/* --- Expansao do substituto --- */ typedef struct { char* p; size_t n, cap; } Buf; static bool b_res(Buf* b, size_t extra) { if (b->n + extra + 1 <= b->cap) return true; @@ -210,7 +210,7 @@ void tb_regex_free_list(char** list) { free(list); } -/* ---------------------------------------------------------------- Blocos */ +/* --- Blocos */ static void eval_test(TinyBlocks_Block* self, TinyBlocks* rt) { bool ok = tb_regex_test(tb_block_input_text(self, rt, 0), tb_block_input_text(self, rt, 1)); diff --git a/libraries/tinyblocks-scratchblocks/src/tb_scratchblocks.c b/libraries/tinyblocks-scratchblocks/src/tb_scratchblocks.c index b3c9a21..a642288 100644 --- a/libraries/tinyblocks-scratchblocks/src/tb_scratchblocks.c +++ b/libraries/tinyblocks-scratchblocks/src/tb_scratchblocks.c @@ -21,7 +21,7 @@ #include "tb_scratchblocks.h" -/* -- Modelos internos (ingles do Scratch 3) ------------------------------- */ +/* -- Modelos internos (ingles do Scratch 3) --- */ /* forma: h chapeu, s comando, c C, C se/senao, e sempre, r repórter, b booleano */ typedef struct { const char* type; const char* text; char shape; bool import_only; } Tpl; @@ -88,7 +88,7 @@ static const Tpl s_builtin[] = { }; #define BUILTIN_N ((int)(sizeof(s_builtin) / sizeof(s_builtin[0]))) -/* -- Texto dinamico -------------------------------------------------------- */ +/* -- Texto dinamico --- */ typedef struct { char* p; size_t n, cap; } Sb; static void sb_add(Sb* b, const char* s, size_t n) { @@ -114,7 +114,7 @@ static void sb_esc(Sb* b, const char* s) { } } -/* -- Tokens ---------------------------------------------------------------- */ +/* -- Tokens --- */ enum { T_WORD, T_ROUND, T_SQUARE, T_ANGLE }; /* palavra, ( ), [ ], < > */ #define TOK_MAX 40 #define TOK_TEXT 256 @@ -228,7 +228,7 @@ static void strip_category(char* s) { } } -/* -- Modelos (internos + rotulos do chamador) ------------------------------ */ +/* -- Modelos (internos + rotulos do chamador) --- */ typedef struct { const char* type; char shape; @@ -347,7 +347,7 @@ static bool model_match(const Model* m, const Tok* t, int n) { static bool shape_is_stmt(char s) { return s == 's' || s == 'h' || s == 'c' || s == 'C' || s == 'e'; } -/* -- Exportar -------------------------------------------------------------- */ +/* -- Exportar --- */ static bool is_literal(const char* type) { return strncmp(type, "Literal.", 8) == 0; } static int block_shape(const Models* M, const char* type) { @@ -530,7 +530,7 @@ char* tb_scratchblocks_export(const TbBpTab* tab, const TbSbContext* cx) { return out.p; } -/* -- Importar -------------------------------------------------------------- */ +/* -- Importar --- */ typedef struct { const Models* M; TbBpTab* tab; diff --git a/libraries/tinyblocks-string/src/tb_string.c b/libraries/tinyblocks-string/src/tb_string.c index 6af4cf0..1a98d63 100644 --- a/libraries/tinyblocks-string/src/tb_string.c +++ b/libraries/tinyblocks-string/src/tb_string.c @@ -22,7 +22,7 @@ #define STR_MAX_OUT (1u << 20) /* teto de 1 MB para "repita" */ -/* -- UTF-8 ---------------------------------------------------------------- */ +/* -- UTF-8 --- */ static size_t u8_len(unsigned char c) { if (c < 0x80) return 1; @@ -77,7 +77,7 @@ static size_t u8_count(const char* s, size_t nbytes) { return n; } -/* -- API ------------------------------------------------------------------ */ +/* -- API --- */ TB_API size_t tb_string_length(const char* s) { return u8_count(s, strlen(s)); @@ -156,7 +156,7 @@ TB_API bool tb_string_is_number(const char* s) { return *e == 0; } -/* -- Entradas ------------------------------------------------------------- */ +/* -- Entradas --- */ /* Texto da entrada i (numeros viram texto). Fica valido ate o proximo uso. */ @@ -174,7 +174,7 @@ static void out_bool(TinyBlocks_Block* self, bool b) { #define TXT(i) tb_block_input_text(self, rt, (i)) -/* -- Blocos --------------------------------------------------------------- */ +/* -- Blocos --- */ static void eval_upper(TinyBlocks_Block* self, TinyBlocks* rt) { out_owned(self, tb_string_upper(TXT(0))); } static void eval_lower(TinyBlocks_Block* self, TinyBlocks* rt) { out_owned(self, tb_string_lower(TXT(0))); } @@ -285,7 +285,7 @@ static void eval_isempty(TinyBlocks_Block* self, TinyBlocks* rt) { free(t); } -/* -- Conversoes ----------------------------------------------------------- */ +/* -- Conversoes --- */ /* "texto de (x)": cada tipo de valor sabe virar texto (classe do valor) */ static void eval_from(TinyBlocks_Block* self, TinyBlocks* rt) { @@ -330,7 +330,7 @@ static void eval_from_code(TinyBlocks_Block* self, TinyBlocks* rt) { out_owned(self, dup_n(buf, n)); } -/* -- Registro ------------------------------------------------------------- */ +/* -- Registro --- */ static bool reg(TinyBlocks* rt, TinyBlocks_LibraryBlock* lib, const char* name, const TinyBlocks_SlotDesc* in, uint32_t ni, diff --git a/libraries/tinyblocks-svg/src/tb_svg.c b/libraries/tinyblocks-svg/src/tb_svg.c index c35c821..4f33b8e 100644 --- a/libraries/tinyblocks-svg/src/tb_svg.c +++ b/libraries/tinyblocks-svg/src/tb_svg.c @@ -23,7 +23,7 @@ static char s_err[200] = ""; const char* tb_svg_last_error(void) { return s_err; } -/* -- Utilitarios de parsing ---------------------------------------------- */ +/* -- Utilitarios de parsing --- */ static void skip_ws(const char** p) { while (**p && (isspace((unsigned char)**p) || **p == ',')) (*p)++; @@ -109,7 +109,7 @@ static bool parse_color(const char* s, float* r, float* g, float* b, float* a) { return false; } -/* -- Cotas de imagens embutidas ------------------------------------------ */ +/* -- Cotas de imagens embutidas --- */ typedef struct { double x, y, w, h; TinyBlocks_Image* img; } SvgImg; #define SVG_MAX_IMGS 16 @@ -157,7 +157,7 @@ static TinyBlocks_Image* decode_data_uri(const char* uri) { return img; } -/* -- Parsing de shapes ---------------------------------------------------- */ +/* -- Parsing de shapes --- */ typedef struct { double* xy; int n, cap; } Pts; @@ -288,7 +288,7 @@ static void parse_path(TinyBlocks_VectorData* v, const char* d, bool do_fill, bo pts_free(&poly); } -/* -- Parse principal ------------------------------------------------------ */ +/* -- Parse principal --- */ static TinyBlocks_VectorData* svg_parse_internal(const char* svg, int* out_w, int* out_h, SvgImg* imgs, int* img_n) { @@ -451,7 +451,7 @@ TinyBlocks_Image* tb_svg_render(const char* svg, int w, int h) { return im; } -/* -- Blocos -------------------------------------------------------------- */ +/* -- Blocos --- */ static void eval_parse(TinyBlocks_Block* self, TinyBlocks* rt) { diff --git a/libraries/tinyblocks-syntax/include/tb_syntax.h b/libraries/tinyblocks-syntax/include/tb_syntax.h index d295b0c..a270a27 100644 --- a/libraries/tinyblocks-syntax/include/tb_syntax.h +++ b/libraries/tinyblocks-syntax/include/tb_syntax.h @@ -19,7 +19,7 @@ TB_API const TinyBlocks_LibraryDescriptor* tb_syntax_get_library(void); -/* -- API C --------------------------------------------------------------- */ +/* -- API C --- */ /* Realca `text` como `lang` e devolve XML (malloc; libere com free). */ TB_API char* tb_syntax_highlight(const char* text, const char* lang); diff --git a/libraries/tinyblocks-syntax/src/tb_syntax.c b/libraries/tinyblocks-syntax/src/tb_syntax.c index ff9de05..55737c9 100644 --- a/libraries/tinyblocks-syntax/src/tb_syntax.c +++ b/libraries/tinyblocks-syntax/src/tb_syntax.c @@ -17,7 +17,7 @@ static char s_err[160] = ""; const char* tb_syntax_last_error(void) { return s_err; } -/* ---------------------------------------------------------------- Buffer */ +/* --- Buffer */ typedef struct { char* p; size_t n, cap; } Buf; static bool b_reserve(Buf* b, size_t extra) { @@ -46,7 +46,7 @@ static void b_esc(Buf* b, const char* s, size_t n) { } } -/* ------------------------------------------------------------- Token tip */ +/* --- Token tip */ typedef enum { T_PLAIN, T_KW, T_TYPE, T_STR, T_NUM, T_CMT, T_PRE, T_FN, T_OP, T_PUNC, T_ID } TK; @@ -96,7 +96,7 @@ const char* tb_syntax_type_color(const char* type) { return tk_color(T_PLAIN); } -/* ------------------------------------------------------------ Linguagens */ +/* --- Linguagens */ typedef struct { const char* name; const char* aliases; /* separados por espaco */ @@ -218,7 +218,7 @@ static bool word_in(const char* list, const char* w, size_t n) { return false; } -/* -------------------------------------------------------------- Emissao */ +/* --- Emissao */ static bool emit(Buf* b, TK k, const char* s, size_t n, bool inline_mode) { (void)inline_mode; if (n == 0) return true; @@ -232,7 +232,7 @@ static bool emit(Buf* b, TK k, const char* s, size_t n, bool inline_mode) { return true; } -/* --------------------------------------------------------- Tokenizadores */ +/* --- Tokenizadores */ static bool is_id_start(int c) { return isalpha(c) || c == '_'; } static bool is_id_char(int c) { return isalnum(c) || c == '_'; } static bool is_op(int c) { @@ -386,7 +386,7 @@ static void tok_md(Buf* b, const char* s, bool inline_mode) { } } -/* ---------------------------------------------------------------- Render */ +/* --- Render */ char* tb_syntax_highlight_inline(const char* text, const char* lang) { s_err[0] = 0; if (!text) text = ""; @@ -435,7 +435,7 @@ char* tb_syntax_highlight(const char* text, const char* lang) { return b.p; } -/* ---------------------------------------------------------------- Blocos */ +/* --- Blocos */ static void eval_highlight(TinyBlocks_Block* self, TinyBlocks* rt) { char* x = tb_syntax_highlight(tb_block_input_text(self, rt, 0), tb_block_input_text(self, rt, 1)); diff --git a/libraries/tinyblocks-toml/src/parser.c b/libraries/tinyblocks-toml/src/parser.c index 5bc2662..9999f9c 100644 --- a/libraries/tinyblocks-toml/src/parser.c +++ b/libraries/tinyblocks-toml/src/parser.c @@ -355,7 +355,7 @@ void toml_free(TomlDoc* doc) { free(doc); } -/* -- Navegacao ----------------------------------------------------------- */ +/* -- Navegacao --- */ const TomlValue* toml_table_get(const TomlValue* table, const char* key) { TomlKeyVal* kv = table_find(table, key); diff --git a/libraries/tinyblocks-vector/src/tb_vector.c b/libraries/tinyblocks-vector/src/tb_vector.c index 2d29b15..65c13e0 100644 --- a/libraries/tinyblocks-vector/src/tb_vector.c +++ b/libraries/tinyblocks-vector/src/tb_vector.c @@ -26,7 +26,7 @@ #define LIST_MAX_RANGE 100000 -/* -- Itens ---------------------------------------------------------------- */ +/* -- Itens --- */ static bool text_number(const char* s, double* out) { while (isspace((unsigned char)*s)) s++; @@ -101,7 +101,7 @@ static bool item_equal(const TinyBlocks_JsonValue* a, const TinyBlocks_JsonValue return strcasecmp(sa, sb) == 0; } -/* -- Listas --------------------------------------------------------------- */ +/* -- Listas --- */ static void push_owned(TinyBlocks_JsonValue* arr, TinyBlocks_JsonValue* item) { if (!item) return; @@ -163,7 +163,7 @@ static TinyBlocks_JsonValue* list_copy(const TinyBlocks_JsonValue* src, uint32_t return arr; } -/* -- Entradas/saidas ------------------------------------------------------ */ +/* -- Entradas/saidas --- */ static TinyBlocks_JsonValue* in_list(TinyBlocks_Block* self, TinyBlocks* rt, uint32_t i) { return tb_vector_from_value(tb_block_get_input(self, rt, i)); @@ -188,7 +188,7 @@ static void out_int(TinyBlocks_Block* self, long long n) { self->dirty = false; } -/* -- Blocos --------------------------------------------------------------- */ +/* -- Blocos --- */ static void eval_empty(TinyBlocks_Block* self, TinyBlocks* rt) { (void)rt; @@ -409,7 +409,7 @@ static void eval_sum(TinyBlocks_Block* self, TinyBlocks* rt) { self->dirty = false; } -/* -- Listas com nome (comandos que mudam a lista, como no Scratch) -------- */ +/* -- Listas com nome (comandos que mudam a lista, como no Scratch) --- */ #define NAMED_MAX 64 typedef struct { char name[64]; TinyBlocks_JsonValue* arr; } NamedList; @@ -554,7 +554,7 @@ static void eval_from(TinyBlocks_Block* self, TinyBlocks* rt) { out_list(self, tb_vector_from_value(v)); } -/* -- Registro ------------------------------------------------------------- */ +/* -- Registro --- */ static bool reg(TinyBlocks* rt, TinyBlocks_LibraryBlock* lib, const char* name, const TinyBlocks_SlotDesc* in, uint32_t ni, diff --git a/libraries/tinyblocks-vg/src/tb_vg.c b/libraries/tinyblocks-vg/src/tb_vg.c index e522466..092f04f 100644 --- a/libraries/tinyblocks-vg/src/tb_vg.c +++ b/libraries/tinyblocks-vg/src/tb_vg.c @@ -156,7 +156,7 @@ TinyBlocks_Image* tb_vg_render(const TinyBlocks_VectorData* v, int w, int h, flo return im; } -/* -- Helpers de construcao ------------------------------------------------ */ +/* -- Helpers de construcao --- */ TinyBlocks_VectorData* tb_vg_new(void) { return tb_vector_data_create(); } @@ -196,7 +196,7 @@ bool tb_vg_polygon(TinyBlocks_VectorData* v, const double* xy, int n, bool close return tb_vector_fill(v, r, g, b, a); } -/* -- Blocos -------------------------------------------------------------- */ +/* -- Blocos --- */ static TinyBlocks_VectorData* in_vec(TinyBlocks_Block* self, TinyBlocks* rt, uint32_t i) { TinyBlocks_Value v = tb_block_get_input(self, rt, i); diff --git a/src/tb_image.c b/src/tb_image.c index 2c75607..083ffb5 100644 --- a/src/tb_image.c +++ b/src/tb_image.c @@ -95,7 +95,7 @@ bool tb_image_get_pixel(const TinyBlocks_Image* img, int x, int y, return true; } -/* -- Registro de formatos ------------------------------------------------- */ +/* -- Registro de formatos --- */ #define TB_IMAGE_MAX_FORMATS 24 diff --git a/src/tb_value.c b/src/tb_value.c index 7fc04de..f101f1e 100644 --- a/src/tb_value.c +++ b/src/tb_value.c @@ -13,7 +13,7 @@ #include #include "tinyblocks/tinyblocks.h" -/* -- Construtores ---------------------------------------------------------- */ +/* -- Construtores --- */ TinyBlocks_Value tb_value_none(void) { @@ -63,7 +63,7 @@ TinyBlocks_Value tb_value_block(TinyBlocks_Block* block) return v; } -/* -- Auxiliares ------------------------------------------------------------ */ +/* -- Auxiliares --- */ bool tb_text_to_number(const char* s, double* out) { @@ -95,7 +95,7 @@ static size_t put(char* out, size_t cap, const char* s) static TinyBlocks_Value obj_copy(TinyBlocks_Value v) { tb_object_retain(v.as.object); return v; } static void obj_release(TinyBlocks_Value* v) { tb_object_release(v->as.object); v->as.object = NULL; } -/* -- Classe: nada ---------------------------------------------------------- */ +/* -- Classe: nada --- */ static size_t none_text(TinyBlocks_Value v, char* out, size_t cap) { (void)v; return put(out, cap, ""); } static bool never(TinyBlocks_Value v) { (void)v; return false; } @@ -104,7 +104,7 @@ static const TinyBlocks_ValueClass s_none = { TB_VALUE_NONE, "nada", NULL, NULL, none_text, NULL, never, NULL, NULL, }; -/* -- Classe: inteiro ------------------------------------------------------- */ +/* -- Classe: inteiro --- */ static size_t int_text(TinyBlocks_Value v, char* out, size_t cap) { return (size_t)snprintf(out, cap, "%lld", (long long)v.as.integer); } @@ -116,7 +116,7 @@ static const TinyBlocks_ValueClass s_integer = { TB_VALUE_INTEGER, "número inteiro", NULL, NULL, int_text, int_num, int_truthy, int_eq, NULL, }; -/* -- Classe: real ---------------------------------------------------------- */ +/* -- Classe: real --- */ static size_t real_text(TinyBlocks_Value v, char* out, size_t cap) { return (size_t)snprintf(out, cap, "%.15g", v.as.real); } @@ -128,7 +128,7 @@ static const TinyBlocks_ValueClass s_real = { TB_VALUE_REAL, "número real", NULL, NULL, real_text, real_num, real_truthy, real_eq, NULL, }; -/* -- Classe: texto --------------------------------------------------------- */ +/* -- Classe: texto --- */ static TinyBlocks_Value text_copy(TinyBlocks_Value v) { return tb_value_text(v.as.text); } static void text_release(TinyBlocks_Value* v) { free(v->as.text); v->as.text = NULL; } @@ -149,7 +149,7 @@ static const TinyBlocks_ValueClass s_text = { TB_VALUE_TEXT, "texto", text_copy, text_release, text_text, text_num, text_truthy, text_eq, NULL, }; -/* -- Classe: referencia a bloco -------------------------------------------- */ +/* -- Classe: referencia a bloco --- */ static size_t block_text(TinyBlocks_Value v, char* out, size_t cap) { @@ -163,7 +163,7 @@ static const TinyBlocks_ValueClass s_block = { TB_VALUE_BLOCK, "bloco", NULL, NULL, block_text, NULL, block_truthy, block_eq, NULL, }; -/* -- Classe: desenho vetorial ---------------------------------------------- */ +/* -- Classe: desenho vetorial --- */ static size_t vec_text(TinyBlocks_Value v, char* out, size_t cap) { return (size_t)snprintf(out, cap, "[desenho com %u comandos]", v.as.vector ? v.as.vector->count : 0u); } @@ -174,7 +174,7 @@ static const TinyBlocks_ValueClass s_vector = { TB_VALUE_VECTOR, "desenho vetorial", obj_copy, obj_release, vec_text, NULL, vec_truthy, vec_eq, NULL, }; -/* -- Classe: JSON (listas e objetos) --------------------------------------- */ +/* -- Classe: JSON (listas e objetos) --- */ /* texto JSON sai sem aspas; o resto, como JSON */ @@ -238,7 +238,7 @@ static const TinyBlocks_ValueClass s_json = { TB_VALUE_JSON, "JSON", obj_copy, obj_release, json_text, json_num, json_truthy, json_eq, json_type_name, }; -/* -- Classe: imagem -------------------------------------------------------- */ +/* -- Classe: imagem --- */ static size_t img_text(TinyBlocks_Value v, char* out, size_t cap) { return (size_t)snprintf(out, cap, "[imagem %dx%d]", tb_image_width(v.as.image), tb_image_height(v.as.image)); } @@ -249,7 +249,7 @@ static const TinyBlocks_ValueClass s_image = { TB_VALUE_IMAGE, "imagem", obj_copy, obj_release, img_text, NULL, img_truthy, img_eq, NULL, }; -/* -- Classe: resultado (Ok | Erro) ----------------------------------------- */ +/* -- Classe: resultado (Ok | Erro) --- */ static size_t res_text(TinyBlocks_Value v, char* out, size_t cap) @@ -279,7 +279,7 @@ static const TinyBlocks_ValueClass s_result = { TB_VALUE_RESULT, "resultado", obj_copy, obj_release, res_text, NULL, res_truthy, res_eq, res_type_name, }; -/* -- Tabela e despacho ----------------------------------------------------- */ +/* -- Tabela e despacho --- */ static const TinyBlocks_ValueClass* const s_classes[TB_VALUE_KIND_COUNT] = { [TB_VALUE_NONE] = &s_none, diff --git a/src/tb_vars.c b/src/tb_vars.c index e12eaa2..673cd80 100644 --- a/src/tb_vars.c +++ b/src/tb_vars.c @@ -24,7 +24,7 @@ static VarTable s_global; static TbVarScope* s_cur = NULL; static TbVarScope* s_live = NULL; -/* -- Tabela ---------------------------------------------------------------- */ +/* -- Tabela --- */ static int table_find(const VarTable* t, const char* name) { for (int i = 0; i < t->n; i++) if (!strcmp(t->v[i].name, name)) return i; @@ -78,7 +78,7 @@ static VarTable* where(const char* name, int* idx) { return NULL; } -/* -- Escopos --------------------------------------------------------------- */ +/* -- Escopos --- */ TbVarScope* tb_vars_scope_new(TbVarScope* parent) { TbVarScope* s = calloc(1, sizeof(TbVarScope)); @@ -103,7 +103,7 @@ void tb_vars_scope_free(TbVarScope* s) { TbVarScope* tb_vars_scope_current(void) { return s_cur; } void tb_vars_scope_set(TbVarScope* s) { s_cur = s; } -/* -- Valores --------------------------------------------------------------- */ +/* -- Valores --- */ const TinyBlocks_Value* tb_vars_get(const char* name) { if (!name || !name[0]) return NULL; @@ -140,7 +140,7 @@ bool tb_vars_delete(const char* name) { return true; } -/* -- Globais --------------------------------------------------------------- */ +/* -- Globais --- */ int tb_vars_global_count(void) { return s_global.n; } const char* tb_vars_global_name(int i) { return (i >= 0 && i < s_global.n) ? s_global.v[i].name : ""; } diff --git a/tests/curves_test.c b/tests/curves_test.c index 89ebab5..9704a21 100644 --- a/tests/curves_test.c +++ b/tests/curves_test.c @@ -28,7 +28,7 @@ static void set_pts(TinyBlocks_Block* b, uint32_t i, TinyBlocks_JsonValue* pts) static bool near(double a, double b) { return fabs(a - b) < 1e-6; } int main(void) { - /* -- API C: reta ---- */ + /* -- API C: reta --- */ TinyBlocks_JsonValue* ln = tb_curves_line(0, 0, 10, 20, 4); CHECK(tb_curves_count(ln) == 5, "reta com 4 passos -> 5 pontos"); double x, y; diff --git a/tests/scratchblocks_test.c b/tests/scratchblocks_test.c index bababdb..abd0c37 100644 --- a/tests/scratchblocks_test.c +++ b/tests/scratchblocks_test.c @@ -73,7 +73,7 @@ static const char* ty(const TbBpTab* t, int bi) { return bi >= 0 ? t->blocks[bi] int main(void) { char warn[256]; - /* -- importar ---------------------------------------------------------- */ + /* -- importar --- */ TbBpTab* t = fresh(); int n = tb_scratchblocks_import(SCRIPT, t, &CX, warn, sizeof(warn)); CHECK(n == 1 && !warn[0], "importa um script (uma pilha, sem avisos)"); @@ -106,7 +106,7 @@ int main(void) { !strcmp(t->blocks[child(t, item, 0)].in_text[0], "frutas"), "item (1) of [frutas v] usa a lista com nome"); - /* -- exportar ---------------------------------------------------------- */ + /* -- exportar --- */ char* txt = tb_scratchblocks_export(t, &CX); CHECK(txt && !strcmp(txt, EXPECTED), "exporta igual ao texto do fórum"); if (txt && strcmp(txt, EXPECTED)) printf("---- obtido:\n%s----\n", txt); @@ -118,7 +118,7 @@ int main(void) { CHECK(txt2 && txt && !strcmp(txt, txt2), "ida e volta (exportar(importar(texto))) é estável"); free(txt); free(txt2); free(t2); free(t); - /* -- blocos só do TinyBlocks: rótulo em português + ::categoria ------- */ + /* -- blocos só do TinyBlocks: rótulo em português + ::categoria --- */ t = fresh(); n = tb_scratchblocks_import( "when flag clicked\n" @@ -141,14 +141,14 @@ int main(void) { CHECK(txt && strstr(txt, "forever\n set pen size to (4)\nend\n"), "sempre (tampa) com corpo"); free(txt); free(t); - /* -- linha desconhecida: avisa e segue -------------------------------- */ + /* -- linha desconhecida: avisa e segue --- */ t = fresh(); n = tb_scratchblocks_import("when flag clicked\nvoe para a lua\nerase all\n", t, &CX, warn, sizeof(warn)); CHECK(n == 1 && strstr(warn, "linha 2"), "linha desconhecida gera aviso com o número da linha"); CHECK(!strcmp(ty(t, t->blocks[t->top[0]].next), "Stage.Clear"), "e o resto continua sendo importado"); free(t); - /* -- texto com colchetes é escapado ----------------------------------- */ + /* -- texto com colchetes é escapado --- */ t = fresh(); tb_scratchblocks_import("say [a \\] b]\n", t, &CX, warn, sizeof(warn)); CHECK(!strcmp(t->blocks[t->top[0]].in_text[0], "a ] b"), "\\] dentro de [ ] é texto"); diff --git a/tests/stdlib_test.c b/tests/stdlib_test.c index 73769ee..acc5f7e 100644 --- a/tests/stdlib_test.c +++ b/tests/stdlib_test.c @@ -198,7 +198,7 @@ int main(void) { tb_block_destroy(bs, rt); } - /* -- Conversoes de tipo ------------------------------------------------ */ + /* -- Conversoes de tipo --- */ CHECK(is_real(run("Number.From", " 3,5 ", NULL, NULL), 3.5), "número de \" 3,5 \" (vírgula decimal)"); CHECK(is_int(run("Number.From", "42", NULL, NULL), 42) && is_int(run("Number.From", "abc", NULL, NULL), 0), "número de texto: inteiro sai inteiro, não-número vira 0");