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
@@ -10,7 +10,7 @@
|
||||
#endif
|
||||
|
||||
/*
|
||||
* tb_python — wrapper fino sobre o interpretador CPython embutido.
|
||||
* 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
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#include "tinyblocks-python/tb_python.h"
|
||||
|
||||
/* ── Singleton ref-counted ───────────────────────────────────────────────── */
|
||||
/* -- Singleton ref-counted --- */
|
||||
static int s_refs = 0;
|
||||
|
||||
TB_PYTHON_API bool tb_python_init(void) {
|
||||
@@ -30,7 +30,7 @@ TB_PYTHON_API void tb_python_deinit(void) {
|
||||
Py_FinalizeEx();
|
||||
}
|
||||
|
||||
/* ── Helper: captura stdout+stderr de uma execução ──────────────────────── */
|
||||
/* -- Helper: captura stdout+stderr de uma execução --- */
|
||||
static char* capture_run(const char* code, PyObject* local_dict) {
|
||||
/* StringIO para capturar output */
|
||||
PyObject* io = PyImport_ImportModule("io");
|
||||
@@ -72,7 +72,7 @@ static char* capture_run(const char* code, PyObject* local_dict) {
|
||||
return out;
|
||||
}
|
||||
|
||||
/* ── API pública ─────────────────────────────────────────────────────────── */
|
||||
/* -- API pública --- */
|
||||
TB_PYTHON_API char* tb_python_run(const char* code) {
|
||||
if (!code || !Py_IsInitialized()) return strdup("");
|
||||
return capture_run(code, NULL);
|
||||
@@ -95,7 +95,7 @@ TB_PYTHON_API char* tb_python_exec_main(const char* code) {
|
||||
PyObject_SetAttrString(sys, "stdout", buf);
|
||||
PyObject_SetAttrString(sys, "stderr", buf);
|
||||
|
||||
/* Executa com main_dict como globals E locals — definições persistem */
|
||||
/* Executa com main_dict como globals E locals - definições persistem */
|
||||
PyObject* result = PyRun_String(code, Py_file_input, main_dict, main_dict);
|
||||
if (!result) { PyErr_Print(); PyErr_Clear(); }
|
||||
Py_XDECREF(result);
|
||||
|
||||
Reference in new issue
Block a user