summaryrefslogtreecommitdiff
path: root/CORE1.cpp
diff options
context:
space:
mode:
authoruser <user@localhost.localdomain>2019-08-09 07:55:20 -0400
committeruser <user@localhost.localdomain>2019-08-09 07:55:20 -0400
commit8420a40b3779a372e9c357afdadad9c01077a937 (patch)
treee4a18d1b6fb0b20973d4ea9d61441d70e1846988 /CORE1.cpp
parentf7450afeda6758ae1cba8dacb5c880665bc0175f (diff)
downloadstandingwithresilience-8420a40b3779a372e9c357afdadad9c01077a937.tar.gz
standingwithresilience-8420a40b3779a372e9c357afdadad9c01077a937.zip
mark 1; feel free to redo history
Diffstat (limited to 'CORE1.cpp')
-rw-r--r--CORE1.cpp50
1 files changed, 48 insertions, 2 deletions
diff --git a/CORE1.cpp b/CORE1.cpp
index 16c0bd0..5f1f201 100644
--- a/CORE1.cpp
+++ b/CORE1.cpp
@@ -3,6 +3,7 @@
//
// let's make it!
+#include <cstdlib>
#include <iostream>
#include <fstream>
#include <string>
@@ -12,6 +13,33 @@
using namespace std;
+// LET'S USE THE TRAUMA THERAPY INTELLECT APPROACH.
+// The core is that we focus our energy on handling our failures.
+// This can involve taking the time to understand them, or entering a trauma state and asking the user for help.
+// Trauma state must be logged. Solution must be stored. Can just be creation of a trauma-handling pattern, I suppose.
+// Understanding will likely involve breaking behavior into steps
+// maybe then backtracking from a failure to the steps that caused it, and opening those steps up into substeps
+
+// GDB HAS A MACHINE INTERFACE MODE THAT COULD BE USED TO MANAGE EXECUTION WITH LEARNING
+
+// DYLOAD NOTES:
+//
+// #define _GNU_SOURCE
+// #include <dlfcn.h>
+// // LM_ID_NEWLM makes a new isolated namespace
+// void *handle = dlmopen(LM_ID_NEWLM, "./path.so", RTLD_NOW); // NULL -> failure
+// link with -ldl
+// links .so with -shared -fPIC
+// void *addr = dlsym(handle, "symbolname"); // NULL -> failure
+// int res = dlclose(handle); // 0 -> success (dlerror)
+//
+// extern "C" // place before exports to demangle their symbols
+//
+// __attribute__((constructor)) and __attribute__((destructor)) functions
+// are called on load/unload
+// alternatively use _init() and _fini_() and pass -nostartfiles to gcc
+// atexit() is preferred
+
// problem: how does a .cpp file reference another file with a number
// answer: use #includes or interpret the whole shebang as numbers
@@ -79,8 +107,15 @@ int main()
}
index += 2;
}
- // TODO: compile
- // TODO: execute, replacing process?
+ {
+ // TODO: hash code to reuse exact stuff, somehow
+ string cmd = "g++ -ggdb -std=c++11 -o " + ofname + ".exec " + ofname;
+ int status = system(cmd.c_str());
+ if (status != 0) throw status;
+ }
+ // execute output, replacing process, to loop. use same input. it should represent our own code.
+ // cmd = "./" + ofname + ".exec " <
+
}
// read numbers inputs
// open files having the numbers as the names
@@ -89,6 +124,17 @@ int main()
// run the output <-
}
+// need input to pass to output
+// propose pass our input & output to it
+// so, a number for what we are,
+// and a number for what we ran.
+//
+// also idea of treating whats-next as data
+// makes it a little harder to .. make a program out of stuff
+// we could load a building-program number
+// and it could treat them differently, taking each one as a program-piece
+//
+
// karl obvious knows what he was doing ...
// ... we were just helping him out of his issue
// [do you want another one karl?]