summaryrefslogtreecommitdiff
path: root/intellect-framework-from-internet/starts/biscuit/2.cpp
diff options
context:
space:
mode:
authorolpc user <olpc@xo-5d-f7-86.localdomain>2020-01-10 14:56:27 -0800
committerolpc user <olpc@xo-5d-f7-86.localdomain>2020-01-10 14:56:27 -0800
commit26c980d302adce8e3d802cb8db8ab1c69d58ce1a (patch)
treee296225f17370c9e472660396b3a51539f76ff28 /intellect-framework-from-internet/starts/biscuit/2.cpp
parent2e01fed206e46a669ba56f57b4b943cfe661a0f1 (diff)
parentc8bb547bea279af2bb48c13260f98aa8add07131 (diff)
downloadstandingwithresilience-26c980d302adce8e3d802cb8db8ab1c69d58ce1a.tar.gz
standingwithresilience-26c980d302adce8e3d802cb8db8ab1c69d58ce1a.zip
Merge branch 'intellect-framework-from-internet'
Diffstat (limited to 'intellect-framework-from-internet/starts/biscuit/2.cpp')
-rw-r--r--intellect-framework-from-internet/starts/biscuit/2.cpp110
1 files changed, 110 insertions, 0 deletions
diff --git a/intellect-framework-from-internet/starts/biscuit/2.cpp b/intellect-framework-from-internet/starts/biscuit/2.cpp
new file mode 100644
index 0000000..15c9481
--- /dev/null
+++ b/intellect-framework-from-internet/starts/biscuit/2.cpp
@@ -0,0 +1,110 @@
+#if !defined(VALCT)
+ #define VALCT 2
+ #define VALS ["1","79"]
+#endif
+
+/* 179 */
+#if defined(IDX)
+ #undef IDX
+#endif
+#define IDX 0
+#if defined(VAL)
+ #undef VAL
+#endif
+#define VAL "1"
+#define ARG "79"
+// This Intellect Approach Can Easily Preserve All Life Within It
+// you just don't delete the programs you generate, instead replacing their habits with references to reuse
+//
+// let's make it!
+
+#include <iostream>
+#include <fstream>
+#include <string>
+#include <vector>
+
+#include <sys/stat.h>
+
+using namespace std;
+
+// problem: how does a .cpp file reference another file with a number
+// answer: use #includes or interpret the whole shebang as numbers
+
+// please provide for handling a parameter next.
+//
+// concept: dynamic values aquirable from inside code, i.e. what-number-called-me what-number-comes-after-me
+// thinking the code would likely evolve to handle some inputs differently
+unsigned long new_number = 1;
+
+int main()
+{
+ string ofname;
+ unsigned long ofnum;
+ {
+ struct stat sb;
+ do
+ {
+ ofnum = new_number++;
+ ofname = to_string(ofnum) + ".cpp";
+ } while (-1 != stat(ofname.c_str(), &sb));
+ }
+
+ {
+ ofstream outfile(ofname);
+ vector<string> vals;
+ while (true) {
+ string val;
+ cin >> val;
+ if (val == "") break;
+ vals.push_back(val);
+ }
+ // when a file runs, it has numbers on input, it also has numbers equal to it
+ // we want to generate run-code with new numbers from input
+ // so we generate something with numbers equal to it, and output that
+ // we have one ref for the whole shebang
+ outfile << "#if !defined(VALCT)" << endl;
+ outfile << " #define VALCT" << " " << vals.size() << endl;
+ outfile << " #define VALS [";
+ for (size_t index = 0; index < vals.size(); ++ index)
+ {
+ if (index > 0) outfile << ",";
+ outfile << "\"" << vals[index] << "\"";
+ }
+ outfile << "]" << endl;
+ outfile << "#endif" << endl;
+ for (size_t index = 0; index < vals.size();)
+ {
+ outfile << endl << "/* " << vals[index] << vals[index+1] << " */" << endl;
+ outfile << "#if defined(IDX)" << endl
+ << " #undef IDX" << endl
+ << "#endif" << endl;
+ outfile << "#define IDX " << index << endl;
+ outfile << "#if defined(VAL)" << endl
+ << " #undef VAL" << endl
+ << "#endif" << endl;
+ outfile << "#define VAL \"" << vals[index] << "\"" << endl;
+ outfile << "#define ARG \"" << vals[index+1] << "\"" << endl;
+ string fname = vals[index] + ".cpp";
+ ifstream code(fname);
+ size_t ctrd = -1;
+ while (ctrd != 0) {
+ char buf[256];
+ ctrd = code.rdbuf()->sgetn(buf, sizeof(buf));
+ outfile.rdbuf()->sputn(buf, ctrd);
+ }
+ index += 2;
+ }
+ }
+// read numbers inputs
+// open files having the numbers as the names
+// cat them all to a gcc process
+// execute
+// run the output
+}
+
+// karl obvious knows what he was doing ...
+// ... we were just helping him out of his issue
+// [do you want another one karl?]
+// what things make / not make issue?
+// karl says everything makes an issue; this seems accurate
+//