computerscare-vcv-modules

computerscare modules for VCV Rack
Log | Files | Refs

commit d3a737aa34f2985bb9d893906003be059d6398b6
parent 50817cc93a2bd46cfa47471c0d08f0409fff6a37
Author: Adam M <[email protected]>
Date:   Wed, 14 Nov 2018 22:03:29 -0600

get one level of recursion working for splitRecur

Diffstat:
M.gitignore | 1+
Msrc/ComputerscareILoveCookies.cpp | 5+----
Msrc/ComputerscareLaundrySoup.cpp | 1-
Msrc/dtpulse.cpp | 13++++++-------
Msrc/dtpulse.hpp | 4++++
Msrc/test.cpp | 5+++--
6 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -2,3 +2,4 @@ build dist .DS_Store plugin.* +a.out diff --git a/src/ComputerscareILoveCookies.cpp b/src/ComputerscareILoveCookies.cpp @@ -19,9 +19,6 @@ const int numInputColumns = 2; const int numKnobs = numKnobRows * numKnobColumns; const int numInputs = numInputRows * numInputColumns; -const std::string knoblookup = "abcdefghijklmnopqrstuvwxyz"; -const std::string inputlookup= "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; -const std::string knobandinputlookup = knoblookup + inputlookup; const std::vector<NVGcolor> outlineColorMap = {COLOR_COMPUTERSCARE_RED,COLOR_COMPUTERSCARE_YELLOW,COLOR_COMPUTERSCARE_BLUE}; class MyTextFieldCookie : public LedDisplayTextField { @@ -108,7 +105,7 @@ struct ComputerscareILoveCookies : Module { std::vector<int> absoluteSequences[numFields]; std::vector<int> nextAbsoluteSequences[numFields]; - + std::string knobandinputlookup = knoblookup + inputlookup; bool shouldChange[numFields] = {false}; int absoluteStep[numFields] = {0}; diff --git a/src/ComputerscareLaundrySoup.cpp b/src/ComputerscareLaundrySoup.cpp @@ -11,7 +11,6 @@ struct ComputerscareLaundrySoup; const int numFields = 6; -const std::string b64lookup = "123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ&$0"; class MyTextField : public LedDisplayTextField { diff --git a/src/dtpulse.cpp b/src/dtpulse.cpp @@ -1,6 +1,5 @@ #include "dtpulse.hpp" -std::string b64lookup = "123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ&$0"; -std::string integerlookup = "0123456789"; + bool is_digits(const std::string &str) { @@ -133,15 +132,15 @@ std::string splitRecur(std::string input) { std::vector<std::string> outputVec; std::string tempStack; std::string output; - std::stringstream inputstream(input); + std::string c; bool inside = false; for(int i = 0; i < input.length(); i++) { - char c = input[i]; - if(c == '(') { + c = input[i]; + if(c == "(") { tempStack = ""; inside = true; } - else if(c == ')') { + else if(c == ")") { outputVec.push_back(tempStack); tempStack = ""; inside = false; @@ -152,7 +151,7 @@ std::string splitRecur(std::string input) { tempStack += c; } else { - outputVec.push_back(c); + outputVec.push_back(c.c_str()); } } diff --git a/src/dtpulse.hpp b/src/dtpulse.hpp @@ -17,3 +17,7 @@ std::string interleaveExpand(std::vector<std::string> blocks); std::string hashExpand(std::string input, int hashnum); std::string atExpand(std::string input, int atnum, std::string lookup); std::string countExpand(std::string input, int atnum); +std::string b64lookup = "123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ&$0"; +std::string integerlookup = "0123456789"; +std::string knoblookup = "abcdefghijklmnopqrstuvwxyz"; +std::string inputlookup= "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; diff --git a/src/test.cpp b/src/test.cpp @@ -1,10 +1,10 @@ #include "dtpulse.cpp" -std::string knoblookup = "abcdefghijklmnopqrstuvwxy"; int main(int argc, char** argv) { int type = 0; std::vector<int> output; std::string strResult = ""; + std::string strParens = ""; if(argv[2]) { type = std::stoi(argv[2]); } @@ -20,7 +20,8 @@ int main(int argc, char** argv) input.push_back(argv[i+3]); } strResult = interleaveExpand(input); - printf("%s\n",strResult.c_str()); + strParens = splitRecur(argv[1]); + printf("splitRecur:%s\ninterleaveExpand:%s\n",strParens.c_str(),strResult.c_str()); } printVector(output); return 0;