Adiciona tinyblocks-blueprint e libraries json/xml/csv; abrir/salvar/exportar projeto

- tinyblocks-blueprint: dona do estado de edicao (abas, pool de blocos,
  vinculos parent/prel/next/sub/args, blocos compostos e variaveis) e da
  serializacao. JSON nativo (to/from) usando a AST JSON do core e export
  JSON/XML/CSV. Testado com round-trip (test-blueprint).
- tinyblocks-json: lexer + parser + emissor JSON independentes.
- tinyblocks-xml: lexer + parser de XML -> AST JSON do core + emissor.
- tinyblocks-csv: divisor de linhas/campos + parser/emissor sobre a AST JSON.
- Editor: botoes Abrir / Salvar / Exportar JSON XML CSV no menu; converte
  Ed <-> TbBlueprint; barra de caminho com modo; .json pode ser arrastado.
- Variaveis: tb_variables_clear e tb_variables_set_text.
- Harness: teste de salvar/abrir projeto; tests/blueprint_test.c.
This commit is contained in:
mguinhos committed 2026-10-20 19:51:48 -03:00
1 parent dc23b92d15
commit 1199d2d7c7
39 files changed
+3462 -24

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
/*
* TinyBlocks - tinyblocks-csv / include/ast.h
*
* A AST do CSV e a arvore JSON do core:
* - sem cabecalho -> array de arrays de strings (linhas);
* - com cabecalho -> array de objetos { coluna: "valor", ... }.
*/
#ifndef TB_CSV_AST_H
#define TB_CSV_AST_H
#include <stddef.h>
#include <stdbool.h>
#include <tinyblocks/tb_json_block.h>
#include "lexeme.h"
TinyBlocks_JsonValue* csv_parse(const char* text, char delim, bool header, char* err, size_t errcap);
TinyBlocks_JsonValue* csv_parse_file(const char* path, char delim, bool header, char* err, size_t errcap);
char* csv_to_string(const TinyBlocks_JsonValue* data, char delim);
bool csv_write_file(const TinyBlocks_JsonValue* data, const char* path, char delim);
#endif /* TB_CSV_AST_H */
+19
View File
@@ -0,0 +1,19 @@
/*
* TinyBlocks - tinyblocks-csv / include/lexeme.h
* Divisao de texto CSV em linhas/campos (com suporte a aspas).
*/
#ifndef TB_CSV_LEXEME_H
#define TB_CSV_LEXEME_H
#include <stddef.h>
#include <stdbool.h>
typedef struct { char** fields; int count, cap; } CsvRow;
typedef struct { CsvRow* rows; int count, cap; } CsvTable;
/* Divide 'text' em linhas/campos. 'delim' costuma ser ',' ou ';'.
* Aspas duplas agrupam campos; "" dentro de aspas representa uma aspa. */
CsvTable* csv_split(const char* text, char delim, char* err, size_t errcap);
void csv_table_free(CsvTable* t);
#endif /* TB_CSV_LEXEME_H */
+21
View File
@@ -0,0 +1,21 @@
/*
* TinyBlocks - tb_csv.h
* Library tinyblocks-csv: parser/emissor de CSV sobre a AST JSON do core.
*/
#ifndef TINYBLOCKS_CSV_H
#define TINYBLOCKS_CSV_H
#include <tinyblocks/tinyblocks.h>
#include "ast.h"
#ifdef __cplusplus
extern "C" {
#endif
TB_API const TinyBlocks_LibraryDescriptor* tb_csv_get_library(void);
#ifdef __cplusplus
}
#endif
#endif /* TINYBLOCKS_CSV_H */