summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbd <bdunahu@operationnull.com>2025-02-24 12:46:43 -0500
committerbd <bdunahu@operationnull.com>2025-02-24 12:46:43 -0500
commit42c03e2ad6110625b54c8aab5960a5d3723e54b0 (patch)
tree0df2f4cc266ecd2f2fc6d773d776dbd5a7989336 /src
initial commit
Diffstat (limited to 'src')
-rw-r--r--src/gui/gui.py0
-rw-r--r--src/memory/driver.cc0
-rw-r--r--src/repl/repl.py10
-rw-r--r--src/rv.cc33
4 files changed, 43 insertions, 0 deletions
diff --git a/src/gui/gui.py b/src/gui/gui.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/gui/gui.py
diff --git a/src/memory/driver.cc b/src/memory/driver.cc
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/memory/driver.cc
diff --git a/src/repl/repl.py b/src/repl/repl.py
new file mode 100644
index 0000000..d78986d
--- /dev/null
+++ b/src/repl/repl.py
@@ -0,0 +1,10 @@
+from code import InteractiveConsole
+
+def start(user):
+ header =f"Press C-d to close."
+ footer = f"See you later, {user}!"
+
+ scope_vars = {"cache_size": 12}
+
+ InteractiveConsole(locals=scope_vars).interact(header, "")
+ return footer
diff --git a/src/rv.cc b/src/rv.cc
new file mode 100644
index 0000000..02d95e2
--- /dev/null
+++ b/src/rv.cc
@@ -0,0 +1,33 @@
+#include <Python.h>
+#include <iostream>
+
+int main() {
+ Py_Initialize();
+ PyRun_SimpleString("import sys; sys.path.append('src/')");
+ PyObject *pName = PyUnicode_DecodeFSDefault("repl.repl");
+ PyObject *pModule = PyImport_Import(pName);
+ Py_DECREF(pName);
+
+ if (pModule != nullptr) {
+ PyObject *pFunc = PyObject_GetAttrString(pModule, "start");
+ if (pFunc && PyCallable_Check(pFunc)) {
+ PyObject *pArgs = PyTuple_Pack(1, PyUnicode_FromString("World"));
+ PyObject *pValue = PyObject_CallObject(pFunc, pArgs);
+ Py_DECREF(pArgs);
+ if (pValue != nullptr) {
+ std::cout << PyUnicode_AsUTF8(pValue) << std::endl;
+ Py_DECREF(pValue);
+ } else {
+ PyErr_Print();
+ std::cerr << "Call failed" << std::endl;
+ }
+ Py_DECREF(pFunc);
+ }
+ Py_DECREF(pModule);
+ } else {
+ PyErr_Print();
+ std::cerr << "Failed to load \"hello\"" << std::endl;
+ }
+ Py_Finalize();
+ return 0;
+}