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:
1 parent
1cc0ff9d02
commit
90d47bf8a0
36 files changed
+327
-327
No files matched your search
+26
-26
@@ -1,24 +1,24 @@
|
||||
/*
|
||||
* json.c — Library de JSON para o TinyBlocks Editor.
|
||||
* json.c - Library de JSON para o TinyBlocks Editor.
|
||||
*
|
||||
* Blocos incluídos:
|
||||
* Json.Parse — texto -> json (null em caso de erro de sintaxe)
|
||||
* Json.Stringify — json -> texto
|
||||
* Json.Null — constrói json null
|
||||
* Json.Bool — inteiro (0/1) -> json bool
|
||||
* Json.Number — real -> json number
|
||||
* Json.String — texto -> json string
|
||||
* Json.Array — constrói array vazio
|
||||
* Json.Object — constrói objeto vazio
|
||||
* Json.Push — (array, valor) -> novo array com valor anexado
|
||||
* Json.Set — (objeto, chave, valor) -> novo objeto com campo definido
|
||||
* Json.Get — (objeto, chave) -> valor do campo, ou Json.Null
|
||||
* Json.Index — (array, índice) -> valor na posição, ou Json.Null
|
||||
* Json.Length — (json) -> nº de elementos (array/objeto) ou 0
|
||||
* Json.TypeOf — (json) -> "null"|"bool"|"number"|"string"|"array"|"object"
|
||||
* Json.ToNumber — (json, default) -> número (ou default se não for number/bool)
|
||||
* Json.ToText — (json) -> string contida, ou "" se não for string
|
||||
* Json.ToBool — (json, default) -> 0/1 (ou default se não for bool/number)
|
||||
* Json.Parse - texto -> json (null em caso de erro de sintaxe)
|
||||
* Json.Stringify - json -> texto
|
||||
* Json.Null - constrói json null
|
||||
* Json.Bool - inteiro (0/1) -> json bool
|
||||
* Json.Number - real -> json number
|
||||
* Json.String - texto -> json string
|
||||
* Json.Array - constrói array vazio
|
||||
* Json.Object - constrói objeto vazio
|
||||
* Json.Push - (array, valor) -> novo array com valor anexado
|
||||
* Json.Set - (objeto, chave, valor) -> novo objeto com campo definido
|
||||
* Json.Get - (objeto, chave) -> valor do campo, ou Json.Null
|
||||
* Json.Index - (array, índice) -> valor na posição, ou Json.Null
|
||||
* Json.Length - (json) -> nº de elementos (array/objeto) ou 0
|
||||
* Json.TypeOf - (json) -> "null"|"bool"|"number"|"string"|"array"|"object"
|
||||
* Json.ToNumber - (json, default) -> número (ou default se não for number/bool)
|
||||
* Json.ToText - (json) -> string contida, ou "" se não for string
|
||||
* Json.ToBool - (json, default) -> 0/1 (ou default se não for bool/number)
|
||||
*
|
||||
* Json.Push/Json.Set não mutam o valor recebido: clonam e devolvem uma nova
|
||||
* árvore, mantendo o fluxo de dados imutável como o resto do TinyBlocks.
|
||||
@@ -27,7 +27,7 @@
|
||||
* make json
|
||||
*
|
||||
* Para carregar no editor:
|
||||
* Ctrl+O → build/json.so ou arraste build/json.so para a janela
|
||||
* Ctrl+O -> build/json.so ou arraste build/json.so para a janela
|
||||
*/
|
||||
|
||||
#define _POSIX_C_SOURCE 200809L
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
#include <tinyblocks/tinyblocks.h>
|
||||
|
||||
/* ── Helpers de leitura de inputs ────────────────────────────────────────── */
|
||||
/* -- Helpers de leitura de inputs --- */
|
||||
static const char* gt(TinyBlocks_Block* self, TinyBlocks* rt, uint32_t idx) {
|
||||
TinyBlocks_Value v = tb_block_get_input(self, rt, idx);
|
||||
return v.kind == TB_VALUE_TEXT ? v.as.text : "";
|
||||
@@ -68,9 +68,9 @@ static TinyBlocks_JsonValue* gj(TinyBlocks_Block* self, TinyBlocks* rt, uint32_t
|
||||
(self)->dirty = false; \
|
||||
} while (0)
|
||||
|
||||
/* ══════════════════════════════════════════════════════════════════════════
|
||||
/* ===
|
||||
* Implementações dos blocos
|
||||
* ══════════════════════════════════════════════════════════════════════════ */
|
||||
* === */
|
||||
|
||||
static void eval_parse(TinyBlocks_Block* self, TinyBlocks* rt) {
|
||||
char err[128] = {0};
|
||||
@@ -191,9 +191,9 @@ static void eval_to_bool(TinyBlocks_Block* self, TinyBlocks* rt) {
|
||||
self->dirty = false;
|
||||
}
|
||||
|
||||
/* ══════════════════════════════════════════════════════════════════════════
|
||||
/* ===
|
||||
* Descritores de slots
|
||||
* ══════════════════════════════════════════════════════════════════════════ */
|
||||
* === */
|
||||
static const TinyBlocks_SlotDesc out_json[] = {{"json", TB_VALUE_JSON}};
|
||||
static const TinyBlocks_SlotDesc out_text[] = {{"text", TB_VALUE_TEXT}};
|
||||
static const TinyBlocks_SlotDesc out_integer[] = {{"n", TB_VALUE_INTEGER}};
|
||||
@@ -217,9 +217,9 @@ static const TinyBlocks_SlotDesc in_json_real[] = {{"json", TB_VALUE_JSON},
|
||||
static const TinyBlocks_SlotDesc in_json_int_def[] = {{"json", TB_VALUE_JSON},
|
||||
{"def", TB_VALUE_INTEGER}};
|
||||
|
||||
/* ══════════════════════════════════════════════════════════════════════════
|
||||
/* ===
|
||||
* Registro da library
|
||||
* ══════════════════════════════════════════════════════════════════════════ */
|
||||
* === */
|
||||
static bool json_init(TinyBlocks* rt, TinyBlocks_LibraryBlock* lib) {
|
||||
TinyBlocks_TypeBlock* t;
|
||||
|
||||
|
||||
Reference in new issue
Block a user