Estado atual do TinyBlocks: editor estilo Scratch + graphics como interface
Snapshot do projeto antes de implementar o diálogo "Criar um Bloco": - runtime C block-based (src/, include/) - libraries: graphics (interface), sdl2 (backend), editor (estilo Scratch), python, mcp - exemplos (hello, sdl2, editor, vector, json, customappearance, python, mcp) - Makefile com alvo help e build do editor Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
commit
4950ad6006
49 files changed
+10596
No files matched your search
@@ -0,0 +1,52 @@
|
||||
#ifndef TINYBLOCKS_PYTHON_H
|
||||
#define TINYBLOCKS_PYTHON_H
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
# define TB_PYTHON_API __declspec(dllexport)
|
||||
#else
|
||||
# define TB_PYTHON_API __attribute__((visibility("default")))
|
||||
#endif
|
||||
|
||||
/*
|
||||
* tb_python — wrapper fino sobre o interpretador CPython embutido.
|
||||
*
|
||||
* O interpretador é compartilhado em todo o processo (singleton ref-counted).
|
||||
* Compile a lib como .so compartilhada para que python.so e mcp.so usem o
|
||||
* mesmo intérprete: libtinyblocks-python.so.
|
||||
*/
|
||||
|
||||
TB_PYTHON_API bool tb_python_init(void);
|
||||
TB_PYTHON_API void tb_python_deinit(void);
|
||||
|
||||
/*
|
||||
* Avalia uma expressão Python.
|
||||
* names/vals: variáveis disponíveis no namespace (n itens).
|
||||
* Retorna string heap-alocada com o resultado (caller frees) ou NULL em erro.
|
||||
*/
|
||||
TB_PYTHON_API char* tb_python_eval(const char* expr,
|
||||
const char* const* names,
|
||||
const double* vals, int n);
|
||||
|
||||
/*
|
||||
* Executa código Python arbitrário.
|
||||
* Captura stdout+stderr e os retorna como string heap-alocada (caller frees).
|
||||
*/
|
||||
TB_PYTHON_API char* tb_python_run(const char* code);
|
||||
|
||||
/*
|
||||
* Executa código passando variáveis como locais (nome=valor float).
|
||||
* Equivalente a tb_python_run mas com namespace preenchido.
|
||||
*/
|
||||
TB_PYTHON_API char* tb_python_run_with_vars(const char* code,
|
||||
const char* const* names,
|
||||
const double* vals, int n);
|
||||
|
||||
/*
|
||||
* Executa código no namespace __main__ (definições persistem entre chamadas).
|
||||
* Retorna stdout+stderr capturado (caller frees).
|
||||
*/
|
||||
TB_PYTHON_API char* tb_python_exec_main(const char* code);
|
||||
|
||||
#endif /* TINYBLOCKS_PYTHON_H */
|
||||
Reference in new issue
Block a user