Initial commit: Klammertext source distribution
Curated source subset assembled by klammertext-dev's doc/make_dist.sh: the Klammermachine (mac), the Standard Klammer Set (sks), the commands (com), editor plugins and install guides (doc), a test subset (tst), and lib/bin placeholders. Builds with 'make -C com'. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
32
mac/eval_python.h
Normal file
32
mac/eval_python.h
Normal file
@@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <Python.h>
|
||||
|
||||
#include "machine.h"
|
||||
|
||||
class Eval_python
|
||||
{
|
||||
public:
|
||||
static std::regex statement_delimiter;
|
||||
explicit Eval_python(Machine& machine, Locator loc);
|
||||
Eval_python(const Eval_python&) = delete;
|
||||
Eval_python& operator=(const Eval_python&) = delete;
|
||||
~Eval_python();
|
||||
void add_module_path(const std::string& path);
|
||||
std::vector<std::string> parse_modules(std::string code);
|
||||
void import_module(std::string module_name, bool verify = true);
|
||||
std::string get_result(PyObject* result_object);
|
||||
std::string eval_expression(std::string expression, bool import_modules = true);
|
||||
std::string eval_statements(std::string script);
|
||||
std::string eval(std::string code);
|
||||
//std::string eval_katom_list(const katom_iter& begin, const katom_iter& end);
|
||||
std::string eval_katom_list(
|
||||
std::vector<Katom>& katoms,
|
||||
const std::vector<Katom>::iterator& begin, const std::vector<Katom>::iterator& end);
|
||||
|
||||
Machine m_machine;
|
||||
Locator m_loc;
|
||||
PyObject* m_globals;
|
||||
PyObject* m_locals;
|
||||
};
|
||||
Reference in New Issue
Block a user