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
+14
-14
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user