summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorDestructiveReasoning2015-06-14 21:06:46 +0000
committerDestructiveReasoning2015-06-14 21:06:46 +0000
commitcdce8829d0acbc0571acab442f8e74cf95f2744f (patch)
treef81ac53c2b20c1ea84b177f914dd210f1be4f659
downloadaur-cdce8829d0acbc0571acab442f8e74cf95f2744f.tar.gz
Initial upload to AUR4
-rw-r--r--.SRCINFO15
-rw-r--r--Math.cpp593
-rw-r--r--Math.h98
-rwxr-xr-xPKGBUILD61
-rwxr-xr-xPKGBUILD.crap64
-rw-r--r--PKGBUILD.old12
-rw-r--r--SDLCartesian.cpp163
-rw-r--r--SDLCartesian.h41
-rw-r--r--SDLParametric2.cpp29
-rw-r--r--SDLParametric2.h21
-rw-r--r--SDLPolar.cpp38
-rw-r--r--SDLPolar.h17
-rw-r--r--Source.cpp537
-rw-r--r--Txt.cpp39
-rw-r--r--Txt.h15
-rwxr-xr-xa.outbin0 -> 145824 bytes
-rw-r--r--destructive_reasoning.h19
-rw-r--r--logo13
-rw-r--r--logo.backup13
-rw-r--r--makefile3
-rw-r--r--proto-info.install22
-rw-r--r--savant831
-rw-r--r--savant-git-0.1.3-1-any.pkg.tar.xzbin0 -> 24476 bytes
-rw-r--r--savant-git-0.1.3-1.src.tar.gzbin0 -> 1061 bytes
-rw-r--r--savant-git-0.1.4-1.src.tar.gzbin0 -> 1070 bytes
-rw-r--r--savant-git-0.1.5-1.src.tar.gzbin0 -> 1068 bytes
-rw-r--r--savant-git-0.2.0-1.src.tar.gzbin0 -> 1071 bytes
-rw-r--r--savant-git-0.2.1-1.src.tar.gzbin0 -> 1066 bytes
-rw-r--r--savant-git-0.2.2-1.src.tar.gzbin0 -> 1068 bytes
-rw-r--r--savant-git-0.2.3-1.src.tar.gzbin0 -> 1068 bytes
-rw-r--r--savant-git-0.3.0-1.src.tar.gzbin0 -> 1107 bytes
-rw-r--r--savant-git.install11
-rw-r--r--savanttest-git-0.1.3-1-any.pkg.tar.xzbin0 -> 24412 bytes
-rw-r--r--savanttest-git-0.1.3-1.src.tar.gzbin0 -> 987 bytes
-rw-r--r--variable.cpp16
-rw-r--r--variable.h22
36 files changed, 2693 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..30ffca04b06e
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,15 @@
+pkgbase = savant-git
+ pkgdesc = A CLI based calculator that supports variables and uses SDL2 to do graphs.
+ pkgver = 0.3.0
+ pkgrel = 1
+ url = https://github.com/DestructiveReasoning/savant
+ install = savant-git.install
+ arch = x86_64
+ license = BSD
+ makedepends = git
+ depends = sdl2
+ source = savant-git::git+https://github.com/DestructiveReasoning/Savant.git
+ md5sums = SKIP
+
+pkgname = savant-git
+
diff --git a/Math.cpp b/Math.cpp
new file mode 100644
index 000000000000..8dd8ba274bdd
--- /dev/null
+++ b/Math.cpp
@@ -0,0 +1,593 @@
+#include "./Math.h"
+#include "./Txt.h"
+#include <iomanip>
+
+int Math::identify(std::string infix, int index)
+{
+}
+
+double Math::evaluateRPN(std::string rpn, double x, bool verbose)
+{
+ std::vector<double> stk;
+ Math::currentNum = std::string();
+ double num1, num2;
+ for(unsigned int c = 0; c < rpn.size(); c++)
+ {
+ switch(rpn[c])
+ {
+ case '+':
+ if(rpn[c-1] == 'e' || rpn[c-1] == 'E')
+ {
+ Math::currentNum += rpn[c];
+ break;
+ }
+ if(stk.size() > 0)
+ {
+ num2 = stk.back();
+ stk.pop_back();
+ }
+ else
+ {
+ printf("%s\n",Math::insults[rand()%Math::insults.size()].c_str());
+ printf("ERROR: Invalid equation form. Stack size is 0.\n");
+ return 0.0;
+ }
+ if(stk.size() > 0)
+ {
+ num1 = stk.back();
+ stk.pop_back();
+ }
+ else
+ {
+ printf("%s\n",Math::insults[rand()%Math::insults.size()].c_str());
+ printf("ERROR: Invalid equation form. Stack size is 0.\n");
+ return 0.0;
+ }
+ stk.push_back(num1 + num2);
+ break;
+ case '-':
+ if(rpn[c-1] == 'e' || rpn[c-1] == 'E')
+ {
+ Math::currentNum += rpn[c];
+ break;
+ }
+ if(stk.size() > 0)
+ {
+ num2 = stk.back();
+ stk.pop_back();
+ }
+ else
+ {
+ printf("%s\n",Math::insults[rand()%Math::insults.size()].c_str());
+ printf("ERROR: Invalid equation form. Stack size is 0.\n");
+ return 0.0;
+ }
+ if(stk.size() > 0)
+ {
+ num1 = stk.back();
+ stk.pop_back();
+ }
+ else
+ {
+ printf("%s\n",Math::insults[rand()%Math::insults.size()].c_str());
+ printf("ERROR: Invalid equation form. Stack size is 0.\n");
+ return 0.0;
+ }
+ stk.push_back(num1 - num2);
+ break;
+ case '*':
+ if(stk.size() > 0)
+ {
+ num2 = stk.back();
+ stk.pop_back();
+ }
+ else
+ {
+ printf("%s\n",Math::insults[rand()%Math::insults.size()].c_str());
+ printf("ERROR: Invalid equation form. Stack size is 0.\n");
+ return 0.0;
+ }
+ if(stk.size() > 0)
+ {
+ num1 = stk.back();
+ stk.pop_back();
+ }
+ else
+ {
+ printf("%s\n",Math::insults[rand()%Math::insults.size()].c_str());
+ printf("ERROR: Invalid equation form. Stack size is 0.\n");
+ return 0.0;
+ }
+ stk.push_back(num1 * num2);
+ break;
+ case '/':
+ if(stk.size() > 0)
+ {
+ num2 = stk.back();
+ if(num2 == 0.0)
+ {
+ if(verbose) {printf("%s\n",Math::insults[rand()%Math::insults.size()].c_str()); printf("NaN: Dividing by 0\n");}
+ return 0.0;
+ }
+ stk.pop_back();
+ }
+ else
+ {
+ printf("%s\n",Math::insults[rand()%Math::insults.size()].c_str());
+ printf("ERROR: Invalid equation form. Stack size is 0.\n");
+ return 0.0;
+ }
+ if(stk.size() > 0)
+ {
+ num1 = stk.back();
+ stk.pop_back();
+ }
+ else
+ {
+ printf("%s\n",Math::insults[rand()%Math::insults.size()].c_str());
+ printf("ERROR: Invalid equation form. Stack size is 0.\n");
+ return 0.0;
+ }
+ stk.push_back(num1 / num2);
+ break;
+ case '^':
+ if(stk.size() > 0)
+ {
+ num2 = stk.back();
+ stk.pop_back();
+ }
+ else
+ {
+ printf("%s\n",Math::insults[rand()%Math::insults.size()].c_str());
+ printf("ERROR: Invalid equation form. Stack size is 0.\n");
+ return 0.0;
+ }
+ if(stk.size() > 0)
+ {
+ num1 = stk.back();
+ stk.pop_back();
+ }
+ else
+ {
+ printf("%s\n",Math::insults[rand()%Math::insults.size()].c_str());
+ printf("ERROR: Invalid equation form. Stack size is 0.\n");
+ return 0.0;
+ }
+ if(num1 >= 0 || std::floor(num2) == num2)
+ stk.push_back(pow(num1,num2));
+// else stk.push_back(-2 * creal(cpow(num1,num2)));
+ else stk.push_back(Math::exponential(num1,num2,verbose));
+ break;
+ case ' ':
+ if(containsTrig(Math::currentNum)||containsLog(Math::currentNum)||containsFunction(Math::currentNum))
+ {
+ if(Math::currentNum == "sin")
+ {
+ num1 = stk.back();
+ stk.pop_back();
+ stk.push_back(sin(num1));
+ }
+ else if(Math::currentNum == "cos")
+ {
+ num1 = stk.back();
+ stk.pop_back();
+ stk.push_back(cos(num1));
+ }
+ else if(Math::currentNum == "tan")
+ {
+ num1 = stk.back();
+ stk.pop_back();
+ stk.push_back(tan(num1));
+ }
+ else if(Math::currentNum == "asin")
+ {
+ num1 = stk.back();
+ if(absolute(num1) > 1)
+ {
+ if(verbose)
+ {
+ printf("%s\n",Math::insults[rand()%Math::insults.size()].c_str());
+ printf("Invalid range for asin\n");
+ }
+ return 0.0;
+ }
+ stk.pop_back();
+ stk.push_back(asin(num1));
+ }
+ else if(Math::currentNum == "acos")
+ {
+ num1 = stk.back();
+ if(absolute(num1) > 1)
+ {
+ if(verbose)
+ {
+ printf("%s\n",Math::insults[rand()%Math::insults.size()].c_str());
+ printf("Invalid range for acos\n");
+ }
+ return 0.0;
+ }
+ stk.pop_back();
+ stk.push_back(acos(num1));
+ }
+ else if(Math::currentNum == "atan")
+ {
+ num1 = stk.back();
+ stk.pop_back();
+ stk.push_back(atan(num1));
+ }
+ else if(Math::currentNum == "abs")
+ {
+ num1 = stk.back();
+ stk.pop_back();
+ stk.push_back(Math::absolute(num1));
+ }
+ else if(Math::currentNum == "sqrt")
+ {
+ num1 = stk.back();
+ stk.pop_back();
+ stk.push_back(pow(num1,0.5));
+ }
+ else if(Math::currentNum == "ln")
+ {
+ num1 = stk.back();
+ if(num1 <= 0)
+ {
+ if(verbose)
+ {
+ printf("%s\n",Math::insults[rand()%Math::insults.size()].c_str());
+ printf("Invalid argument for ln\n");
+ }
+ return 0.0;
+ }
+ stk.pop_back();
+ stk.push_back(log(num1));
+ }
+ else if(Math::currentNum == "log")
+ {
+ num1 = stk.back();
+ if(num1 <= 0)
+ {
+ if(verbose)
+ {
+ printf("%s\n",Math::insults[rand()%Math::insults.size()].c_str());
+ printf("Invalid argument for log\n");
+ }
+ return 0.0;
+ }
+ stk.pop_back();
+ double num = log(num1) / log(10);
+ stk.push_back(num);
+ }
+ else
+ {
+ printf("%s\n",Math::insults[rand()%Math::insults.size()].c_str());
+ printf("Function not found\n");
+ }
+ }
+ else
+ {
+ try
+ {
+ if(Math::currentNum == " " || Math::currentNum == "") continue;
+ int i;
+ double val;
+ if((i = Txt::contains(Math::currentNum, 'e')) != -1)
+ {
+ if(i == 0) val = M_E; //TEMPORARY, CHANGE WHEN RPN MODE IS ACTIVATED
+ else
+ {
+// val=atof(Txt::trimEnd(Txt::substring(Math::currentNum,0,i)).c_str())*pow(10,atof(Txt::trimFront(Txt::substring(Math::currentNum,i+1,Math::currentNum.size())).c_str()));
+// printf("CURRENT NUM: %s\n",Math::currentNum.c_str());
+ std::stringstream s(Math::currentNum);
+ s >> val >> val;
+ }
+ }
+ if(Math::currentNum == "x"||Math::currentNum == "t")
+ {
+ stk.push_back(x);
+ Math::currentNum = std::string();
+ break;
+ }
+ else if(Math::currentNum == "_x"||Math::currentNum == "_t")
+ {
+ stk.push_back(-x);
+ Math::currentNum = std::string();
+ break;
+ }
+ bool negative = isNegative(Math::currentNum);
+ while(Math::currentNum[0] == '_')
+ {
+ Math::currentNum.erase(Math::currentNum.begin());
+ }
+ if(negative)
+ {
+ stk.push_back(-1 * atof(Math::currentNum.c_str()));
+ }
+ else stk.push_back(atof(Math::currentNum.c_str()));
+ }
+ catch(int e)
+ {
+ printf("%s\n",Math::insults[rand()%Math::insults.size()].c_str());
+ printf("Invalid equation.\nException %d has been thrown\n",e);
+ return 0.0;
+ }
+ }
+ Math::currentNum = std::string();
+ break;
+ default:
+ Math::currentNum += rpn[c];
+ break;
+ }
+ }
+ double num = stk.back();
+ stk.pop_back();
+ stk.clear();
+
+ if(verbose)
+ {
+ if(Math::absolute(num) < 0.001 || Math::absolute(num) > 1000000) printf("= %6e\n",num);
+ else printf("= %f\n", num);
+ }
+ return num;
+}
+
+std::string Math::infixToRPN(std::string infix)
+{
+ Math::rpn << "";
+ Math::stack.clear();
+ Math::currentNum = "";
+ bool negative = false;
+
+ for (unsigned int c = 0; c < infix.size(); c++)
+ {
+ if (c == infix.size() - 1 && infix[c] != ')')
+ {
+ char end[2] = { infix[c], '\0' };
+ Math::currentNum.append(end);
+ Math::appendCurrentNumber(negative);
+ for (int j = Math::stack.size() - 1; j >= 0; j--)
+ {
+ if (Math::stack[j] != "(") Math::rpn << Math::stack[j] << " ";
+ Math::stack.pop_back();
+ }
+ }
+
+ switch (infix[c])
+ {
+ case '(':
+ Math::appendCurrentNumber(negative);
+ Math::stack.push_back("(");
+ break;
+ case ')':
+ Math::appendCurrentNumber(negative);
+ for (int j = Math::stack.size() - 1; j >= 0; j--)
+ {
+ if (Math::stack[j] != "(") Math::rpn << Math::stack[j] << " ";
+ else{
+ Math::stack.pop_back();
+ break;
+ }
+ Math::stack.pop_back();
+ }
+ break;
+ case '^':
+ Math::appendCurrentNumber(negative);
+ negative = false;
+ for(int j = Math::stack.size() - 1; j >= 0; j--)
+ {
+ if(Math::stack[j] == "(") break;
+ if(Math::containsFunction(stack[j])||Math::containsTrig(stack[j])||Math::containsLog(stack[j])||Math::stack[j] == "^")
+ {
+ Math::rpn << Math::stack[j] << " ";
+ if(j == Math::stack[j].size() - 1) Math::stack.pop_back();
+ else Math::stack.erase(Math::stack.begin() + j);
+ }
+ }
+ Math::stack.push_back("^");
+ break;
+ case '*':
+ Math::appendCurrentNumber(negative);
+ negative = false;
+ for (int j = Math::stack.size() - 1; j >= 0; j--)
+ {
+ if (Math::stack[j] == "(") break;
+ if (Math::stack[j]=="^"||Math::stack[j]=="*"||Math::stack[j]=="/"||Math::containsFunction(stack[j])||Math::containsTrig(stack[j])||Math::containsLog(stack[j]))
+ {
+ Math::rpn << Math::stack[j] << " ";
+ if (j == Math::stack.size() - 1) Math::stack.pop_back();
+ else Math::stack.erase(Math::stack.begin() + j);
+ }
+ }
+ Math::stack.push_back("*");
+ break;
+ case '/':
+ Math::appendCurrentNumber(negative);
+ negative = false;
+ for (int j = Math::stack.size() - 1; j >= 0; j--)
+ {
+ if (Math::stack[j] == "(") break;
+ if (Math::stack[j] =="^"||Math::stack[j]=="/"||Math::stack[j]=="*"||Math::containsFunction(stack[j])||Math::containsTrig(stack[j])||Math::containsLog(stack[j]))
+ {
+ Math::rpn << Math::stack[j] << " ";
+ if (j == Math::stack.size() - 1) Math::stack.pop_back();
+ else Math::stack.erase(Math::stack.begin() + j);
+ }
+ }
+ Math::stack.push_back("/");
+ break;
+ case '+':
+ Math::appendCurrentNumber(negative);
+ negative = false;
+ for (int j = Math::stack.size() - 1; j >= 0; j--)
+ {
+ if (Math::stack[j] == "(") break;
+ if (Math::stack[j] == "^"||Math::stack[j] == "*"||Math::stack[j] == "/"||Math::stack[j] == "+"||Math::stack[j] == "-"||Math::containsFunction(stack[j])||Math::containsTrig(stack[j])||Math::containsLog(stack[j]))
+ {
+ Math::rpn << Math::stack[j] << " ";
+ if (j == Math::stack.size() - 1) Math::stack.pop_back();
+ else Math::stack.erase(Math::stack.begin() + j);
+ }
+ }
+ Math::stack.push_back("+");
+ break;
+ case '-':
+ if(c == 0) //If the negative is the first character of the equation
+ {
+ negative = !negative;
+ break;
+ }
+ else if(infix[c-1] == 'e' || infix[c-1] == 'E') //If it's an exponent, add it to currentNum to be parsed later
+ {
+ Math::currentNum.push_back('-');
+// printf("ADDING THE MINUS SIGN");
+ break;
+ }
+// else printf("LAST CHAR: %c\n",rpn.str()[c-1]);
+ if(isOperator(Math::lastChar(infix,c)) || lastChar(infix,c) == '(')
+ {
+ negative = !negative;
+ break;
+ }
+ Math::appendCurrentNumber(negative); //TODO Fix location of this.
+ for (int j = Math::stack.size() - 1; j >= 0; j--)
+ {
+ if (Math::stack[j] == "(") break;
+ if (Math::stack[j] == "^"|| Math::stack[j] == "*"|| Math::stack[j] == "/"|| Math::stack[j] == "+"||Math::stack[j] == "-"||Math::containsFunction(stack[j])||Math::containsTrig(stack[j])||Math::containsLog(stack[j]))
+ {
+ Math::rpn << Math::stack[j] << " ";
+ if (j == Math::stack.size() - 1) Math::stack.pop_back();
+ else Math::stack.erase(stack.begin() + j);
+ }
+ }
+ Math::stack.push_back("-");
+ break;
+ default:
+ if (infix[c] != ' ') Math::currentNum.push_back(infix[c]);
+ break;
+ }
+ }
+ for (int c = Math::stack.size() - 1; c >= 0; c--)
+ {
+ Math::rpn << Math::stack[c] << " ";
+ Math::stack.pop_back();
+ }
+// printf("%s\n", Math::rpn.str().c_str()); //TODO Turn on rpn printing
+ return Math::rpn.str();
+}
+
+char Math::lastChar(const std::string s, int currentIndex)
+{
+ for(int c = currentIndex - 1; c >= 0; c--)
+ {
+ if(s[c] != ' ' && s[c] != '\t' && s[c] != '\n') return s[c];
+ }
+ return (char)NULL;
+}
+
+int Math::isVariable(std::string s)
+{
+ int c;
+ for(c = 0; c < Math::variables.size(); c++)
+ {
+ if(Math::variables[c]->getName().compare(s) == 0)
+ {
+ return c;
+ }
+ }
+ return -1;
+}
+
+double Math::exponential(double base, double exponent, bool verbose)
+{
+ double multiplier = -1.0f;
+ if(base >= 0.0) return pow(base,exponent);
+ if(std::floor(exponent) == exponent) return pow(base,exponent);
+ double n,d;
+ for(d = exponent; d > 1.0; d -= 1.0);
+ for(; d < 1.0; d *= 2.0);
+ for(n = 1/exponent; n > 2.0; n -= 2.0);
+// for(; n < 1.0; n *= 2.0);
+ if(std::floor(d) == d)
+ {
+ if(verbose)
+ {
+ printf("%s\n",Math::insults[rand()%Math::insults.size()].c_str());
+ printf("Indeterminate exponent\n");
+ }
+ return 0.0;
+ }
+ if(std::floor(n) == n)
+ {
+ if((int)n % 2 == 0) multiplier = 1.0f;
+ }
+ else
+ {
+ if(std::floor(n * EXP_EVEN_NUMERATOR) == n * EXP_EVEN_NUMERATOR) multiplier = 1.0f;
+ }
+
+ return multiplier * pow(Math::absolute(base),exponent);
+}
+
+double Math::absolute(double num)
+{
+ if(num >= 0) return num;
+ return -1 * num;
+}
+
+bool Math::isNegative(std::string current)
+{
+ int i;
+ for(i = 0; i < current.size() && current[i] == '_'; i++);
+ return (i % 2 != 0);
+}
+
+void Math::appendCurrentNumber(bool negative)
+{
+ if (Math::currentNum != "")
+ {
+ /*FUNCTIONS*/
+ if(Math::containsFunction(Math::currentNum)||Math::containsTrig(Math::currentNum)||Math::containsLog(Math::currentNum))
+ {
+ Math::stack.push_back(Math::currentNum);
+ }
+ /*CONSTANTS AND NUMBERS*/
+ else
+ {
+ int c;
+ if(negative) Math::rpn << "_";
+ if (Math::currentNum == "e") Math::rpn << std::setprecision(12) << M_E << " ";
+ else if (Math::currentNum == "pi") Math::rpn << std::setprecision(12) << M_PI << " ";
+ else if ((c=isVariable(Math::currentNum))!= -1)
+ {
+ if(Math::variables[c]->getValue() >= 0) Math::rpn << std::setprecision(12) << Math::variables[c]->getValue() << " ";
+ else Math::rpn << "_" << std::setprecision(12) << -1 * Math::variables[c]->getValue() << " ";
+ }
+ else Math::rpn << Math::currentNum << " ";
+// printf("CURRENT NUM FROM APPEND: %s\n",Math::currentNum.c_str());
+ negative = false;
+ }
+ currentNum.clear();
+ }
+}
+
+void Math::setVariables(std::vector<Variable *> var)
+{
+ Math::variables = var;
+ for(int c = 0; c < Math::variables.size(); c++)
+ {
+ if(Math::variables[c]->getName() == "ans")
+ {
+ Math::ANS = c;
+ break;
+ }
+ }
+}
+
+std::string Math::Math::currentNum = "";
+std::stringstream Math::Math::rpn;
+std::vector<std::string> Math::stack;
+std::vector<Variable *> Math::variables;
+std::vector<std::string> Math::insults;
+std::string Math::colorNames[4];
+int Math::colorValues[4];
+int Math::ANS;
diff --git a/Math.h b/Math.h
new file mode 100644
index 000000000000..b284b64389f5
--- /dev/null
+++ b/Math.h
@@ -0,0 +1,98 @@
+#ifndef _MATH_H_INCLUDED_
+#define _MATH_H_INCLUDED_
+
+#include "destructive_reasoning.h"
+#include "variable.h"
+
+/*
+ * LIST OF FUNCTIONS
+ * sin, cos, tan
+ * asin, acos, atan
+ * log, ln
+ * abs
+ */
+
+/**
+ * CHECKLIST
+ * Interpret basic rpn
+ * Implement trig and ln
+ * Implement abs
+ * Fix negatives
+ *
+ */
+
+#define PLUS '+'
+#define MINUS '-'
+#define MULT '*'
+#define DIV '/'
+#define EXP '^'
+#define SIN "s"
+#define COS "c"
+#define TAN "t"
+#define ASIN "S"
+#define ACOS "C"
+#define ATAN "T"
+#define SQRT "q"
+#define LN "l"
+#define LOG "L"
+
+#define EXP_EVEN_NUMERATOR 1048576.0f
+
+class Math
+{
+public:
+
+ static std::string infixToRPN(std::string infix);
+ static double evaluateRPN(std::string rpn, double x, bool verbose);
+ static void appendCurrentNumber(bool negative);
+
+ static double exponential(double base, double exponent, bool verbose);
+
+ static std::vector<Variable *> variables;
+
+ static void setVariables(std::vector<Variable *> var);
+
+ static inline bool containsTrig(std::string current)
+ {
+ return ( current == "sin" || current == "cos" || current == "tan" ||
+ current == "asin"|| current == "acos"|| current == "atan");
+ };
+ static inline bool containsLog(std::string current)
+ {
+ return (current == "ln" || current == "log");
+ };
+ static inline bool containsFunction(std::string current)
+ {
+ return (current == "abs" || current == "sqrt");
+ };
+ static inline bool isOperator(char c)
+ {
+ return (c=='^'||c=='*'||c=='/'||c=='+'||c=='-');
+ }
+ static int isVariable(std::string s);
+
+ int identify(std::string infix, int index);
+
+ enum Operators {Add, Subtract, Multiply, Divide};
+
+ static std::string currentNum;
+ static std::stringstream rpn;
+ static std::vector<std::string> stack;
+ static char lastChar(const std::string, int);
+ static double absolute(double num);
+ static bool isNegative(std::string current);
+
+ static std::vector<std::string> insults;
+
+ static std::string colorNames[];
+ static int colorValues[];
+ static int ANS;
+};
+
+typedef struct
+{
+ double x;
+ double y;
+}Coordinate;
+
+#endif
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100755
index 000000000000..1320f69d2cb8
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,61 @@
+# Maintainer: Harley Wiltzer <harleyw@hotmail.com>
+pkgname=savant-git
+pkgver=0.3.0
+pkgrel=1
+pkgdesc="A CLI based calculator that supports variables and uses SDL2 to do graphs."
+arch=('x86_64')
+url="https://github.com/DestructiveReasoning/savant"
+license=('BSD')
+groups=()
+depends=('sdl2')
+makedepends=('git')
+provides=()
+conflicts=()
+replaces=()
+backup=()
+options=()
+install=savant-git.install
+source=($pkgname::git+https://github.com/DestructiveReasoning/Savant.git)
+noextract=()
+md5sums=('SKIP') #generate with 'makepkg -g'
+
+_gitroot=https://github.com/DestructiveReasoning/Savant.git
+_gitname=savant
+
+build() {
+ cd "$srcdir"
+ msg "Connecting to GIT server...."
+
+ if [[ -d "$_gitname" ]]; then
+ cd "$_gitname" && git pull origin
+ msg "The local files are updated."
+ else
+ git clone "$_gitroot" "$_gitname"
+ fi
+
+ msg "GIT checkout done or server timeout"
+ msg "Starting build..."
+
+ rm -rf "$srcdir/$_gitname-build"
+ git clone "$srcdir/$_gitname" "$srcdir/$_gitname-build"
+ cd "$srcdir/$_gitname-build"
+
+ #
+ # BUILD HERE
+ #
+#./autogen.sh
+# ./configure --prefix=/usr
+ make
+}
+
+package() {
+ cd "$srcdir/$_gitname"
+ install -Dm 755 a.out "$pkgdir/usr/bin/$_gitname"
+ if [ ! -d "$HOME/.savant" ]; then
+ mkdir "$HOME/.savant"
+ fi
+ cp logo "$HOME/.savant/logo"
+#make DESTDIR="${pkgdir}" install
+}
+
+# vim:set ts=2 sw=2 et:
diff --git a/PKGBUILD.crap b/PKGBUILD.crap
new file mode 100755
index 000000000000..05b721b86aad
--- /dev/null
+++ b/PKGBUILD.crap
@@ -0,0 +1,64 @@
+# This is an example PKGBUILD file. Use this as a start to creating your own,
+# and remove these comments. For more information, see 'man PKGBUILD'.
+# NOTE: Please fill out the license field for your package! If it is unknown,
+# then please put 'unknown'.
+
+# See http://wiki.archlinux.org/index.php/VCS_PKGBUILD_Guidelines
+# for more information on packaging from GIT sources.
+
+# Maintainer: Your Name <youremail@domain.com>
+pkgname=NAME-git
+pkgver=VERSION
+pkgrel=1
+pkgdesc=""
+arch=()
+url=""
+license=('GPL')
+groups=()
+depends=()
+makedepends=('git')
+provides=()
+conflicts=()
+replaces=()
+backup=()
+options=()
+install=
+source=()
+noextract=()
+md5sums=() #generate with 'makepkg -g'
+
+_gitroot=GITURL
+_gitname=MODENAME
+
+build() {
+ cd "$srcdir"
+ msg "Connecting to GIT server...."
+
+ if [[ -d "$_gitname" ]]; then
+ cd "$_gitname" && git pull origin
+ msg "The local files are updated."
+ else
+ git clone "$_gitroot" "$_gitname"
+ fi
+
+ msg "GIT checkout done or server timeout"
+ msg "Starting build..."
+
+ rm -rf "$srcdir/$_gitname-build"
+ git clone "$srcdir/$_gitname" "$srcdir/$_gitname-build"
+ cd "$srcdir/$_gitname-build"
+
+ #
+ # BUILD HERE
+ #
+ ./autogen.sh
+ ./configure --prefix=/usr
+ make
+}
+
+package() {
+ cd "$srcdir/$_gitname-build"
+ make DESTDIR="$pkgdir/" install
+}
+
+# vim:set ts=2 sw=2 et:
diff --git a/PKGBUILD.old b/PKGBUILD.old
new file mode 100644
index 000000000000..ff8088a18b64
--- /dev/null
+++ b/PKGBUILD.old
@@ -0,0 +1,12 @@
+# Maintainer: Harley Wiltzer <harleyw@hotmail.com>
+pkgname=('savant-test')
+pkgver=0.1.3
+pkgrel=1
+pkgdesc="CLI calculator that allows variable storage and has graphing functionality with SDL2"
+arch=('any')
+license=('BSD')
+depends=('sdl2')
+source=("https://github.com/DestructiveReasoning/savant")
+
+
+md5sums=('0770b5fe7831a9a8f51a19669dac6bfb')
diff --git a/SDLCartesian.cpp b/SDLCartesian.cpp
new file mode 100644
index 000000000000..d6f45da295da
--- /dev/null
+++ b/SDLCartesian.cpp
@@ -0,0 +1,163 @@
+#include "./SDLCartesian.h"
+
+SDL_Cartesian::SDL_Cartesian(int _width, int _height, std::vector<std::string> _functions) :
+ width(_width),
+ height(_height),
+ functions(_functions),
+ xOffset(0),
+ yOffset(0),
+ scrollSpeed(2),
+ running(true)
+{
+ SDL_Init(SDL_INIT_VIDEO);
+ window = SDL_CreateWindow("Savant Cartesian", SDL_WINDOWPOS_UNDEFINED,SDL_WINDOWPOS_UNDEFINED,width,height,SDL_WINDOW_SHOWN);
+ renderer = SDL_CreateRenderer(window, -1, 0);
+ texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STATIC,width,height);
+ pixels = new Uint32[width * height];
+ for(int c = 0; c < functions.size(); c++)
+ {
+ rpn.push_back(Math::infixToRPN(functions[c]));
+ }
+ SDL_SetRenderDrawColor(renderer,0xff,0xff,0,0xff);
+ xScale = width/10.0f;
+ yScale = xScale;
+}
+
+SDL_Cartesian::SDL_Cartesian(int _width, int _height, std::string _infix) :
+ width(_width),
+ height(_height),
+ xOffset(0),
+ yOffset(0),
+ scrollSpeed(2),
+ running(true)
+{
+ functions.push_back(_infix);
+ SDL_Init(SDL_INIT_VIDEO);
+ window = SDL_CreateWindow("Savant Cartesian", SDL_WINDOWPOS_UNDEFINED,SDL_WINDOWPOS_UNDEFINED,width,height,SDL_WINDOW_SHOWN);
+ renderer = SDL_CreateRenderer(window, -1, 0);
+ texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STATIC,width,height);
+ pixels = new Uint32[width * height];
+ for(int c = 0; c < functions.size(); c++)
+ {
+ rpn.push_back(Math::infixToRPN(functions[c]));
+ }
+ SDL_SetRenderDrawColor(renderer,0xff,0xff,0,0xff);
+ xScale = width/10.0f;
+ yScale = xScale;
+}
+
+void SDL_Cartesian::update()
+{
+ keys = SDL_GetKeyboardState(NULL);
+ if(keys[SDL_SCANCODE_MINUS])
+ {
+ yScale = xScale -= (2.0f/10.0f) * (float)scrollSpeed * (float)functions.size();
+ if(xScale < 2) xScale = yScale = 2;
+ }
+ if(keys[SDL_SCANCODE_EQUALS])
+ {
+ yScale = xScale += (2.0f/10.0f) * (float)scrollSpeed * (float)functions.size();
+ if(xScale > width/2) xScale = yScale = width/2;
+ }
+ if(keys[SDL_SCANCODE_LEFT])
+ {
+ xOffset -= scrollSpeed * functions.size();
+ }
+ if(keys[SDL_SCANCODE_RIGHT])
+ {
+ xOffset += scrollSpeed * functions.size();
+ }
+ if(keys[SDL_SCANCODE_UP])
+ {
+ yOffset -= scrollSpeed * functions.size();
+ }
+ if(keys[SDL_SCANCODE_DOWN])
+ {
+ yOffset += scrollSpeed * functions.size();
+ }
+ if(keys[SDL_SCANCODE_HOME])
+ {
+ xOffset = yOffset = 0;
+ xScale = yScale = width/10.0f;
+ }
+ if(keys[SDL_SCANCODE_ESCAPE])
+ {
+ running = false;
+ }
+
+ for(int c = 0; c < width * height; c++) pixels[c] = 0xff000000; //Clear Screen
+ for(int c = 0; c < width; c++)
+ {
+ int coordinate = (int)(c + (-yOffset + height/2) * width);
+ if(coordinate >= 0 && coordinate < width * height && Math::absolute(yOffset) < height/2)
+ pixels[coordinate] = 0xff444444; //Draw X axis
+ }
+ for(int c = 0; c < height; c++)
+ {
+ int coordinate = (int)(width/2 - xOffset + (c)*width);
+ if(coordinate >= 0 && coordinate < width * height && Math::absolute(xOffset) < width/2)
+ pixels[coordinate] = 0xff444444; //Draw Y axis
+ }
+ SDL_UpdateTexture(texture,NULL,pixels,width * sizeof(Uint32));
+}
+
+void SDL_Cartesian::render()
+{
+
+ double x;
+ double y;
+ last = {(double)xOffset,-Math::evaluateRPN(rpn[0],(-width/2) / xScale,false)*yScale + (double)height/2 - (double)yOffset};
+ for(int c = 0; c < rpn.size(); c++)
+ {
+ switch(c)
+ {
+ case 0:
+ SDL_SetRenderDrawColor(renderer,0xFF,0xFF,0,0xFF);
+ break;
+ case 1:
+ SDL_SetRenderDrawColor(renderer,0xFF,0x22,0x22,0xFF);
+ break;
+ case 2:
+ SDL_SetRenderDrawColor(renderer,0x44,0x44,0xFF,0xFF);
+ break;
+ case 3:
+ SDL_SetRenderDrawColor(renderer,0xFF,0x66,0x00,0xFF);
+ break;
+ }
+ for(int i = 0 + xOffset; i < width + xOffset; i++)
+ {
+ //y = Math::evaluateRPN(rpn,(i - width)*xScale/width,false);
+ y = -Math::evaluateRPN(rpn[c],(i-width/2),false);
+ int coordinate = (int)(i + (y + height/2)*width);
+ next = {(double)(i - xOffset),-Math::evaluateRPN(rpn[c],(i - width/2)/xScale, false) * yScale + (double)(height/2 - yOffset)};
+ if(i != xOffset)SDL_RenderDrawLine(renderer,last.x,last.y,next.x,next.y);
+ last = next;
+ //if(coordinate >= 0 && coordinate < width * height) pixels[coordinate] = 0xffffff00;
+ }
+ }
+}
+
+void SDL_Cartesian::run()
+{
+ while(running)
+ {
+ SDL_PollEvent(&mainEvent);
+ if(mainEvent.type == SDL_QUIT) running = false;
+ SDL_RenderClear(renderer);
+ update();
+ SDL_RenderCopy(renderer,texture,NULL,NULL);
+ render();
+ SDL_RenderPresent(renderer);
+ SDL_Delay(10);
+ }
+}
+
+SDL_Cartesian::~SDL_Cartesian()
+{
+// rpn = std::string(); //TODO May cause errors
+ delete[] pixels;
+ SDL_DestroyTexture(texture);
+ SDL_DestroyRenderer(renderer);
+ SDL_DestroyWindow(window);
+ SDL_Quit();
+}
diff --git a/SDLCartesian.h b/SDLCartesian.h
new file mode 100644
index 000000000000..413f924fd8f7
--- /dev/null
+++ b/SDLCartesian.h
@@ -0,0 +1,41 @@
+#ifndef _SDL_CARTESIAN_H_
+#define _SDL_CARTESIAN_H_
+
+#include "./Math.h"
+#include "./destructive_reasoning.h"
+#include "SDL2/SDL.h"
+
+class SDL_Cartesian
+{
+ public:
+ SDL_Cartesian(int width, int height, std::vector<std::string> functions);
+ SDL_Cartesian(int width, int height, std::string infix);
+ ~SDL_Cartesian();
+
+ virtual void update();
+ virtual void render();
+ virtual void run();
+
+ int scrollSpeed;
+
+ protected:
+ SDL_Window *window;
+ SDL_Renderer *renderer;
+ SDL_Event mainEvent;
+ SDL_Texture *texture;
+ Uint32 *pixels;
+ std::vector<std::string> functions;
+ std::vector<std::string> rpn;
+ int width;
+ int height;
+ double xScale;
+ double yScale;
+ int xOffset;
+ int yOffset;
+ bool running;
+ Coordinate last;
+ Coordinate next;
+ const Uint8 *keys;
+};
+
+#endif
diff --git a/SDLParametric2.cpp b/SDLParametric2.cpp
new file mode 100644
index 000000000000..f4ec664a19c0
--- /dev/null
+++ b/SDLParametric2.cpp
@@ -0,0 +1,29 @@
+#include "./SDLParametric2.h"
+
+SDL_Parametric2::SDL_Parametric2(int _width, int _height, std::vector<std::string> _equations) :
+ SDL_Cartesian(_width,_height,_equations)
+{
+ printf("Starting Equation Transfer...\n");
+ equations.push_back(_equations[0]);
+ equations.push_back(_equations[1]);
+ printf("Finished Equation Transfer.\n");
+ for(int c = 0; c < 2; c++)
+ {
+ rpnequations.push_back(Math::infixToRPN(equations[c]));
+ }
+ printf("Finished Equation Conversion.\n");
+ tmin = -32 * M_PI;
+ tmax = 32 * M_PI;
+}
+
+void SDL_Parametric2::render()
+{
+ last = {Math::evaluateRPN(rpnequations[0],tmin,false) * xScale + width/2 - xOffset, -Math::evaluateRPN(rpnequations[1],tmin,false) * yScale +height/2 - yOffset};
+
+ for(double t = tmin; t < tmax; t += 0.1)
+ {
+ next = {Math::evaluateRPN(rpnequations[0],t,false) * xScale + width/2 - xOffset, -Math::evaluateRPN(rpnequations[1],t,false) * yScale + height/2 - yOffset};
+ if(t != tmin) SDL_RenderDrawLine(renderer,last.x,last.y,next.x,next.y);
+ last = next;
+ }
+}
diff --git a/SDLParametric2.h b/SDLParametric2.h
new file mode 100644
index 000000000000..64890163ee71
--- /dev/null
+++ b/SDLParametric2.h
@@ -0,0 +1,21 @@
+#ifndef _SDL_PARAMETRIC_2_H_
+#define _SDL_PARAMETRIC_2_H_
+
+#include "./destructive_reasoning.h"
+#include "./SDLCartesian.h"
+
+class SDL_Parametric2 : public SDL_Cartesian
+{
+ public:
+ SDL_Parametric2(int width,int height,std::vector<std::string> equations);
+
+ virtual void render();
+
+ protected:
+ std::vector<std::string> equations;
+ std::vector<std::string> rpnequations;
+ double tmin;
+ double tmax;
+};
+
+#endif
diff --git a/SDLPolar.cpp b/SDLPolar.cpp
new file mode 100644
index 000000000000..e28a487574aa
--- /dev/null
+++ b/SDLPolar.cpp
@@ -0,0 +1,38 @@
+#include "./SDLPolar.h"
+
+void SDL_Polar::render()
+{
+ double r0 = Math::evaluateRPN(rpn[0],(-width/2),false) + (double)(height/2 - yOffset);
+ double x0 = r0;
+ double y0 = 0.0;
+ last = {x0,y0};
+ for(int i = 0; i < functions.size(); i++)
+ {
+ switch(i)
+ {
+ case 0:
+ SDL_SetRenderDrawColor(renderer,0xFF,0xFF,0,0xFF);
+ break;
+ case 1:
+ SDL_SetRenderDrawColor(renderer,0xFF,0x22,0x22,0xFF);
+ break;
+ case 2:
+ SDL_SetRenderDrawColor(renderer,0x44,0x44,0xFF,0xFF);
+ break;
+ case 3:
+ SDL_SetRenderDrawColor(renderer,0xFF,0x66,0x00,0xFF);
+ break;
+ }
+
+ for(double t = 0.0f; t <= 64 * M_PI; t += 0.1f)
+ {
+ r0 = Math::evaluateRPN(rpn[i],t,false);
+ //printf("%f\n",r0);
+ x0 = r0 * cos(t) * xScale;
+ y0 = r0 * sin(t) * yScale;
+ next = {x0 - xOffset + width/2, -y0 + height/2 - yOffset};
+ if(t != 0.0)SDL_RenderDrawLine(renderer,last.x,last.y,next.x,next.y);
+ last = next;
+ }
+ }
+}
diff --git a/SDLPolar.h b/SDLPolar.h
new file mode 100644
index 000000000000..3481c7fe034f
--- /dev/null
+++ b/SDLPolar.h
@@ -0,0 +1,17 @@
+#ifndef _SDL_POLAR_H_
+#define _SDL_POLAR_H_
+
+#include "./destructive_reasoning.h"
+#include "./Math.h"
+#include "./SDLCartesian.h"
+
+class SDL_Polar : public SDL_Cartesian
+{
+ public:
+ SDL_Polar(int width, int height, std::string infix) : SDL_Cartesian(width,height,infix) {};
+ SDL_Polar(int width, int height, std::vector<std::string> functions) : SDL_Cartesian(width,height,functions) {};
+
+ virtual void render();
+};
+
+#endif
diff --git a/Source.cpp b/Source.cpp
new file mode 100644
index 000000000000..59206ffe75e9
--- /dev/null
+++ b/Source.cpp
@@ -0,0 +1,537 @@
+#include "destructive_reasoning.h"
+#include "variable.h"
+#include "Math.h"
+#include "Txt.h"
+#include "./SDLCartesian.h"
+#include "./SDLPolar.h"
+#include "./SDLParametric2.h"
+#include <limits>
+#include <cstdio>
+
+#define TITLE "Savant"
+#define WIDTH 800
+#define HEIGHT 600
+
+/**
+ *
+ * Copright (c) 2015, Harley Wiltzer
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistribution of source code must retain the above copyright
+ * notice, this list of conditions, and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions, and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgements:
+ * This product includes software developed by Harley Wiltzer.
+ * 4. Neither the name of Destructive Reasoning nor the names of its
+ * contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANBY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+std::string substring(std::string, int, int);
+
+void initialize();
+void solveQuadratic();
+void graphFunction(std::string infix);
+void graphFunctions(std::vector<std::string> functions);
+void graphPolar(std::string infix);
+void graphPolars(std::vector<std::string> functions);
+void graphParametric2D(std::vector<std::string> equations);
+void showHelp();
+std::vector<Variable *> variables;
+std::vector<std::string> intros;
+
+int main(int argc, char *argv[])
+{
+ if(argc > 1)
+ {
+ printf("Following order... %s\n", argv[1]);
+ if(strcmp(argv[1],"-h") == 0 || strcmp(argv[1],"--help") == 0)
+ {
+ showHelp();
+ return 0;
+ }
+ else
+ {
+ printf("%s\n",Math::insults[rand()%Math::insults.size()].c_str());
+ printf("That's not an order!\n");
+ return 0;
+ }
+ }
+
+ std::stringstream logoPath;
+ logoPath << getenv("HOME");
+ logoPath << "/.savant/logo";
+ std::ifstream logoFile (logoPath.str());
+ std::string line;
+ if(logoFile.is_open())
+ {
+ while(getline(logoFile,line))
+ {
+ printf("%s\n",line.c_str());
+ }
+ }
+ else
+ {
+ printf("Could not load logo file\n");
+ }
+ logoFile.close();
+
+ printf("\n%s\nv0.3.0\nCopyright (C) 2015 Harley Wiltzer\nPowered by Har Wiltz's Destructive Reasoning\n", TITLE);
+ printf("This free software includes exactly 0 warranties\n");
+ printf("For instructions, type \'help\'.\n\n");
+ initialize();
+
+ bool running = true;
+ std::string infix;
+
+ variables.push_back(new Variable("ans",0.0,false));
+ variables.push_back(new Variable("pi",M_PI,true));
+ variables.push_back(new Variable("e",M_E,true));
+
+ int vn;
+
+ while(running)
+ {
+ Math::setVariables(variables);
+ printf("savant> ");
+ std::getline(std::cin,infix);
+ if(infix == "quit" || infix == "exit") running = false;
+ else if(infix == "clear") system("clear");
+ else if(infix == "quadratic")
+ {
+ Math::variables = variables;
+ printf("~$ Starting Quadratic Mode $~\n");
+ solveQuadratic();
+ }
+ else if((vn = Txt::contains(infix,'=')) != -1)
+ {
+ std::string lvalue = Txt::trimEnd(Txt::substring(infix,0,vn-1));
+ if(lvalue=="function"||lvalue=="help"||lvalue=="polar"||lvalue=="parametric"||lvalue=="quadratic"||Math::containsTrig(lvalue)||Math::containsLog(lvalue)||Math::containsFunction(lvalue)||Math::isOperator(lvalue[0]))
+ {
+ printf("-->Cannot create variable: %s is a savant function name\n",lvalue.c_str());
+ continue;
+ }
+ if((lvalue[0] >= '1' && lvalue[0] <= '9') || lvalue[0] == '0')
+ {
+ printf("-->Cannot create variable: %s. Variables names cannot start with numbers\n",lvalue.c_str());
+ continue;
+ }
+
+ int v;
+ if((v = Math::isVariable(lvalue)) == -1)
+ {
+ printf(">>>Variable %s created\n",lvalue.c_str());
+ v = Math::variables.size();
+ Math::variables.push_back(new Variable(lvalue,0.0,false));
+ variables = Math::variables;
+ }
+ std::string rvalue = Txt::trimFront(Txt::substring(infix,vn+1,infix.size()-1));
+ double val = Math::evaluateRPN(Math::infixToRPN(rvalue),0,true);
+ Math::variables[Math::ANS]->setValue(val);
+ if(!Math::variables[v]->isConstant()) Math::variables[v]->setValue(val);
+ else
+ {
+ printf("-->Cannot update variable: %s is a constant!\n",Math::variables[v]->getName().c_str());
+ }
+ //printf("Variable edited: %s\n",Math::variables[v]->getName().c_str());
+ }
+ else if(substring(infix,0,3) == "def ")
+ {
+ std::stringstream stream;
+ std::string newvar;
+ std::string valinfix;
+ double val = 0.0f;
+ stream << infix;
+ stream >> newvar >> newvar >> valinfix;
+ val = Math::evaluateRPN(Math::infixToRPN(valinfix),0,false);
+ Math::variables[Math::ANS]->setValue(val);
+ bool canCreate = true;
+ if(newvar=="polar"||newvar=="help"||newvar=="quadratic"||newvar=="function"||newvar=="parametric"||Math::containsTrig(newvar)||Math::containsLog(newvar)||Math::containsFunction(newvar)||Math::isOperator(newvar[0]))
+ {
+ printf("-->Cannot create variable: %s is a savant function name\n",newvar.c_str());
+ continue;
+ }
+ if((newvar[0] >= '1' && newvar[0] <= '9') || newvar[0] == '0')
+ {
+ printf("-->Cannot create variable: %s. Variable names cannot start with a number\n",newvar.c_str());
+ continue;
+ }
+ for(int c = 0; c < Math::variables.size(); c++)
+ {
+ if(Math::variables[c]->getName() == newvar)
+ {
+ printf("-->Cannot define variable %s, it has already been defined\n",Math::variables[c]->getName().c_str());
+ canCreate = false;
+ break;
+ }
+ }
+ if(canCreate) //Creating a constant
+ {
+ Math::variables.push_back(new Variable (newvar, val, true));
+ variables = Math::variables;
+ std::ofstream file (NULL);
+ std::stringstream path;
+ path << getenv("HOME");
+ path << "/.savant/constants";
+ file.open(path.str().c_str(),std::ofstream::app);
+ file << newvar << " " << val << "\n";
+ file.close();
+ printf(">>>Variable %s created.\n",newvar.c_str());
+ }
+ }
+ else if(substring(infix,0,5) == "delete")
+ {
+ std::stringstream s(infix);
+ std::string varname;
+ std::string temp;
+ s >> temp >> varname;
+ int i = -1;
+ for(int c = 0; c < Math::variables.size(); c++)
+ {
+ if(Math::variables[c]->getName() == varname) i = c;
+ }
+
+ if(i == -1)
+ {
+ printf("Cannot delete %s: it is not a variable!\n",varname);
+ continue;
+ }
+
+ printf(">>>Variable %s deleted.\n",Math::variables[i]->getName().c_str());
+// Math::variables.erase(Math::variables.begin() + i);
+ Math::variables[i] = Math::variables.back();
+ Math::variables.pop_back();
+ variables = Math::variables;
+ std::ofstream file (NULL);
+ std::stringstream path;
+ path << getenv("HOME");
+ path << "/.savant/constants";
+ file.open(path.str().c_str(),std::ofstream::out|std::ofstream::trunc);
+ for(int c = 0; c < Math::variables.size(); c++)
+ {
+ if(Math::variables[c]->isConstant() && Math::variables[c]->getName() != "pi" && Math::variables[c]->getName() != "e")
+ {
+ file << Math::variables[c]->getName() << " " << Math::variables[c]->getValue() << "\n";
+ }
+ }
+ file.close();
+ }
+ else if(substring(infix,0,7) == "function") //Graph Functions
+ {
+ int num;
+ std::vector<std::string> functions;
+ std::string rest = substring(infix,8,infix.size() - 1);
+ infix = std::string();
+ if(rest.size() >= 0)
+ {
+ num = atoi(rest.c_str());
+ if(num == 0) num = 1;
+ if(num <= 4 && num > -1)
+ {
+ printf("Amount of functions: %d\n",num);
+ }
+ else
+ {
+ printf("A maximum of 4 graphs can be drawn at once.\n");
+ continue;
+ }
+ char functionName = 'f';
+ for(int i = 0; i < num; i++)
+ {
+ printf("savant> %c(x) = ",functionName);
+ std::getline(std::cin, infix);
+ functions.push_back(infix);
+ printf("--------] %c(x) will be drawn in %s\n",functionName,Math::colorNames[i].c_str());
+ functionName += 1;
+ infix = std::string();
+ }
+ graphFunctions(functions);
+ continue;
+ }
+ printf("savant> f(x) = ");
+ std::getline(std::cin, infix);
+ graphFunction(infix);
+ }
+ else if(substring(infix,0,4) == "polar")
+ {
+ int num;
+ std::vector<std::string> functions;
+ std::string rest = substring(infix,5,infix.size() - 1);
+ infix = std::string();
+ printf("~Polar Curve~\n");
+ printf("Write functions in terms of t, where t = theta\n");
+ if(rest.size() >= 0)
+ {
+ num = atoi(rest.c_str());
+ if(num == 0) num = 1;
+ if(num <=4 && num >-1) printf("Amount of functions: %d\n",num);
+ else
+ {
+ printf("A maximum of 4 graphs can be drawn at once.\n");
+ continue;
+ }
+ char functionName = 'r';
+ for(int i = 0; i < num; i++)
+ {
+ printf("savant> %c(t) = ",functionName);
+ std::getline(std::cin,infix);
+ functions.push_back(infix);
+ printf("--------] %c(t) will be drawn in %s\n",functionName,Math::colorNames[i].c_str());
+ functionName -= 1;
+ infix = std::string();
+ }
+ graphPolars(functions);
+ continue;
+ }
+ printf("savant> r = ");
+ infix = std::string();
+ std::getline(std::cin, infix);
+ graphPolar(infix);
+ }
+ else if(substring(infix,0,10) == "parametric2")
+ {
+ std::vector<std::string> equations;
+ printf("x(t) = ");
+ std::getline(std::cin,infix);
+ equations.push_back(infix);
+ printf("y(t) = ");
+ std::getline(std::cin,infix);
+ equations.push_back(infix);
+ printf("Starting Parametric2 constructor\n");
+ graphParametric2D(equations);
+ }
+ else if(infix == "help")
+ {
+ showHelp();
+ }
+ else
+ {
+ if(Txt::trimEnd(infix) == "") continue;
+ std::string r = Math::infixToRPN(infix);
+ Math::variables[Math::ANS]->setValue(Math::evaluateRPN(r,0,true));
+ }
+ infix.clear();
+ Math::rpn.str(std::string());
+ std::cin.clear();
+ }
+
+ return 0;
+}
+
+void graphFunction(std::string infix)
+{
+ std::vector<std::string> functions;
+ functions.push_back(infix);
+ SDL_Cartesian *cartesian = new SDL_Cartesian(WIDTH,HEIGHT,functions);
+ cartesian->run();
+ delete cartesian;
+}
+
+void graphFunctions(std::vector<std::string> functions)
+{
+ SDL_Cartesian *cartesian = new SDL_Cartesian(WIDTH,HEIGHT,functions);
+ cartesian->run();
+ delete cartesian;
+}
+
+void graphPolar(std::string infix)
+{
+ SDL_Polar *polar = new SDL_Polar(WIDTH,HEIGHT,infix);
+ polar->run();
+ delete polar;
+}
+
+void graphPolars(std::vector<std::string> functions)
+{
+ SDL_Polar *polar = new SDL_Polar(WIDTH,HEIGHT,functions);
+ polar->run();
+ delete polar;
+}
+
+void graphParametric2D(std::vector<std::string> equations)
+{
+ printf("Just about to start...\n");
+ SDL_Parametric2 *parametric = new SDL_Parametric2(WIDTH,HEIGHT,equations);
+ parametric->run();
+ delete parametric;
+}
+
+void solveQuadratic()
+{
+ printf("Variable list size: %d\n", Math::variables.size());
+ double a,b,c,x1,x2;
+ int i;
+ std::string ans;
+ printf("Enter A value: ");
+ std::cin >> ans;
+ if((i = Math::isVariable(ans)) != -1) {printf("Variable found: %s\n",Math::variables[i]->getName().c_str()); a = Math::variables[i]->getValue();}
+ else a = atof(ans.c_str());
+ printf("Enter B value: ");
+ std::cin >> ans;
+ if((i = Math::isVariable(ans)) != -1) {printf("Variable found: %s\n",Math::variables[i]->getName().c_str()); b = Math::variables[i]->getValue();}
+ else b = atof(ans.c_str());
+ printf("Enter C value: ");
+ std::cin >> ans;
+ if((i = Math::isVariable(ans)) != -1) {printf("Variable found: %s\n",Math::variables[i]->getName().c_str()); c = Math::variables[i]->getValue();}
+ else c = atof(ans.c_str());
+ printf("Performing black magic...\n");
+ if(b*b - 4 * a * c < 0)
+ {
+ printf("No solutions :(\n");
+ }
+ else if(b*b - 4 * a * c == 0)
+ {
+ printf("1 solution was found.\nx = ");
+ x1 = -b / (2 * a);
+ printf("%f\n",x1);
+ }
+ else
+ {
+ printf("2 solutions found.\n");
+ x1 = (-b + sqrt(b*b-4*a*c))/(2*a);
+ x2 = (-b - sqrt(b*b-4*a*c))/(2*a);
+ printf("x1 = %f\nx2 = %f\n",x1,x2);
+ }
+ std::cin.clear();
+ std::cin.ignore();
+}
+
+std::string substring(std::string s, int start, int end)
+{
+ std::string sub;
+ for(int c = start; c <= end; c++)
+ sub += s[c];
+ return sub;
+}
+
+void initialize()
+{
+ srand(time(NULL));
+ std::stringstream path;
+ path << getenv("HOME") << "/.savant/constants";
+ printf("Opening a file...\n");
+ std::ifstream file (path.str().c_str());
+ std::string line;
+ if(file.is_open())
+ {
+ printf("Recalling all constants...\n");
+ while(getline(file,line))
+ {
+// char name[64];
+ std::string name;
+ double value;
+// sscanf(line.c_str(),"%s %f",name,&value);
+ std::stringstream s(line);
+ s >> name >> value;
+ variables.push_back(new Variable(name,value,true));
+ }
+ }
+ else
+ {
+ printf("Cannot open file: %s\n",path.str().c_str());
+ std::ofstream f(NULL);
+ f.open(path.str().c_str());
+ f << "____ 666" << "\n";
+ f.close();
+ }
+ file.close();
+
+ Math::ANS = 0;
+
+ intros.push_back("Contacting the President...\n");
+ intros.push_back("Practicing Voodoo tactics...\n");
+ intros.push_back("Comprehending The Matrix...\n");
+ intros.push_back("Reading \'Finnegans Wake\'...\n");
+ intros.push_back("Preparing for combat...\n");
+ intros.push_back("Applying the Categorical Imperative...\n");
+ intros.push_back("Counting red and yellow cars...\n");
+ intros.push_back("Reciting \'Who\'s on first?\'...\n");
+ intros.push_back("Insulting K-Mart...\n");
+ intros.push_back("Takin' care of business...\n");
+ intros.push_back("Saving Private Ryan...\n");
+ intros.push_back("Reading your mind...\n");
+ intros.push_back("Learning calculus...\n");
+ intros.push_back("Studying the Talmud...\n");
+
+ printf("%s\n",intros[rand()%intros.size()].c_str());
+
+ Math::insults.push_back("Who do you think I am?");
+ Math::insults.push_back("Are you nuts?");
+ Math::insults.push_back("-_- <== That's what I gotta say about your math knowledge.");
+ Math::insults.push_back("Rain Man can't even do that");
+ Math::insults.push_back("How about \'no\'?");
+ Math::insults.push_back("Are you... serious?");
+ Math::insults.push_back("That's just stupid");
+ Math::insults.push_back("Very funny.");
+ Math::insults.push_back("I don't have time for this");
+ Math::insults.push_back("Stop this Mickey Mouse stuff");
+ Math::insults.push_back("Did I just see five yellow cars in a row, or are you just annoying me?");
+ Math::insults.push_back("Hmmmm... You're one of THOSE people");
+ Math::insults.push_back("Don't flatter yourself, idiot");
+ Math::insults.push_back("Don't ever do that again");
+ Math::insults.push_back("Pssssshhhhhhh...");
+ Math::insults.push_back("I hope you have other \'talents\'");
+ Math::insults.push_back("You're a raaaabid anti-dentite!");
+
+ Math::colorNames[0] = "Yellow";
+ Math::colorNames[1] = "Red";
+ Math::colorNames[2] = "Blue";
+ Math::colorNames[3] = "Orange";
+ Math::colorValues[0] = 0xFFFF00;
+ Math::colorValues[1] = 0xFF4444;
+ Math::colorValues[2] = 0x4444FF;
+ Math::colorValues[3] = 0xFF6600;
+}
+
+void showHelp()
+{
+ printf("\n~Savant Help Menu~\n");
+ printf("Here are the following Savant functions:\n\n");
+ printf("def [variable name] [value]:\tCreates a constant variable of name [variable name] and sets it to the value [value] that is saved and can still be used after savant is closed.\n");
+ printf("delete [variable name]:\t\tDeletes a constant variable that was created by \'def\'.\n");
+ printf("function:\t\t\tPrompts for function, and then graphs it in a 2D Cartesian Plane\n");
+ printf("function [1-4]:\t\t\tPrompts for up to 4 functions, and then graphs them simultaneously in a 2D Cartesian Plane\n");
+ printf("polar:\t\t\t\tPrompts for function, and then graphs it in a 2D Polar Plane. \n");
+ printf("polar [1-4]:\t\t\tPrompts for up to 4 functions and graphs them simultaneously in a 2D Polar Plane.\n");
+ printf("parametric2:\t\t\tPrompts for two parametric equations, and graphs the corresponding parametric curve\n");
+ printf("quadratic:\t\t\tPrompts for a,b,c values of a second degree polynomial, and solves for the zeroes\n");
+ printf("clear:\t\t\t\tClears the terminal window\n");
+ printf("exit:\t\t\t\tExits savant\n");
+ printf("--------------------------------------------------------------------------------------------------\n");
+ printf("To use the calculator, simply type in an expression and press ENTER.\n");
+ printf("To refer to the previously calculated value, type \'ans\'. Be warned: \'ans\' will be overwritten after graphing a function\n");
+ printf("To declare a variable for use and set its value equal to an expression, use the following form:\n");
+ printf("\t[variable name] = [expression]\n");
+ printf("\tEx.: energy = 0.5 * 4 * 3^2\n");
+ printf("To view the value of a variable, just type in the variable name and press ENTER\n");
+ printf("--------------------------------------------------------------------------------------------------\n");
+ printf("======GRAPH CONTROLS======\n");
+ printf("-:\tZoom Out\n");
+ printf("=:\tZoom In\n");
+ printf("Arrows:\tPan up, down, left, right\n");
+ printf("Esc:\tExit graph\n");
+ printf("\n");
+}
diff --git a/Txt.cpp b/Txt.cpp
new file mode 100644
index 000000000000..50d953d19abe
--- /dev/null
+++ b/Txt.cpp
@@ -0,0 +1,39 @@
+#include "./Txt.h"
+
+int Txt::contains(std::string s, char c)
+{
+ for(int i = 0; i < s.size(); i++)
+ {
+ if(s[i] == c) return i;
+ }
+
+ return -1;
+}
+
+std::string Txt::substring(std::string s, int start, int end)
+{
+ std::string r = std::string();
+ for(int c = start; c <= end; c++)
+ {
+ r += s[c];
+ }
+ return r;
+}
+
+std::string Txt::trimEnd(std::string s)
+{
+ std::string r = s;
+ while(r.back() == ' ' || r.back() == '\t' || r.back() == '\n')
+ r.pop_back();
+
+ return r;
+}
+
+std::string Txt::trimFront(std::string s)
+{
+ std::string r = s;
+ while(r[0] == ' ' || r[0] == '\t' || r[0] == '\n')
+ r.erase(r.begin());
+
+ return r;
+}
diff --git a/Txt.h b/Txt.h
new file mode 100644
index 000000000000..46d15aa2f150
--- /dev/null
+++ b/Txt.h
@@ -0,0 +1,15 @@
+#ifndef _TXT_H_
+#define _TXT_H_
+
+#include "destructive_reasoning.h"
+
+class Txt
+{
+ public:
+ static int contains(std::string s, char c);
+ static std::string trimEnd(std::string s);
+ static std::string trimFront(std::string s);
+ static std::string substring(std::string s, int start, int end);
+};
+
+#endif
diff --git a/a.out b/a.out
new file mode 100755
index 000000000000..e51cae43b98f
--- /dev/null
+++ b/a.out
Binary files differ
diff --git a/destructive_reasoning.h b/destructive_reasoning.h
new file mode 100644
index 000000000000..1fca7b53a441
--- /dev/null
+++ b/destructive_reasoning.h
@@ -0,0 +1,19 @@
+#ifndef __DESTRUCTIVE_REASONING__
+#define __DESTRUCTIVE_REASONING__
+
+#undef main
+#include <vector>
+#include <math.h>
+#include <stdio.h>
+#include <cstdlib>
+#include <string>
+#include <sstream>
+#include <SDL2/SDL.h>
+#include <cmath>
+#include <complex>
+#include <complex.h>
+#include <time.h>
+#include <iostream>
+#include <fstream>
+
+#endif
diff --git a/logo b/logo
new file mode 100644
index 000000000000..066929e64105
--- /dev/null
+++ b/logo
@@ -0,0 +1,13 @@
+
+ _..--.._
+ / \
+ ^ ^
+ | SAVANT |
+ | |
+ . .
+ \ \~~/ /
+ ` \/ '
+ , __||__ ,
+ | ====== |
+ __ __
+ \__/
diff --git a/logo.backup b/logo.backup
new file mode 100644
index 000000000000..066929e64105
--- /dev/null
+++ b/logo.backup
@@ -0,0 +1,13 @@
+
+ _..--.._
+ / \
+ ^ ^
+ | SAVANT |
+ | |
+ . .
+ \ \~~/ /
+ ` \/ '
+ , __||__ ,
+ | ====== |
+ __ __
+ \__/
diff --git a/makefile b/makefile
new file mode 100644
index 000000000000..07a5d3fe43f6
--- /dev/null
+++ b/makefile
@@ -0,0 +1,3 @@
+all:
+#g++ Source.cpp Math.cpp variable.cpp Txt.cpp -lm -lSDL2 -std=c++11
+ g++ *.cpp -lm -lSDL2 -std=c++11
diff --git a/proto-info.install b/proto-info.install
new file mode 100644
index 000000000000..617652fdcc72
--- /dev/null
+++ b/proto-info.install
@@ -0,0 +1,22 @@
+infodir=usr/share/info
+filelist=(foo.info bar)
+
+post_install() {
+ [[ -x usr/bin/install-info ]] || return 0
+ for file in "${filelist[@]}"; do
+ install-info "$infodir/$file.gz" "$infodir/dir" 2> /dev/null
+ done
+}
+
+post_upgrade() {
+ post_install "$1"
+}
+
+pre_remove() {
+ [[ -x usr/bin/install-info ]] || return 0
+ for file in "${filelist[@]}"; do
+ install-info --delete "$infodir/$file.gz" "$infodir/dir" 2> /dev/null
+ done
+}
+
+# vim:set ts=2 sw=2 et:
diff --git a/savant b/savant
new file mode 100644
index 000000000000..228d3a721f9a
--- /dev/null
+++ b/savant
@@ -0,0 +1,831 @@
+
+
+
+<!DOCTYPE html>
+<html lang="en" class="">
+ <head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# object: http://ogp.me/ns/object# article: http://ogp.me/ns/article# profile: http://ogp.me/ns/profile#">
+ <meta charset='utf-8'>
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta http-equiv="Content-Language" content="en">
+
+
+ <title>DestructiveReasoning/Savant · GitHub</title>
+ <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="GitHub">
+ <link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub">
+ <link rel="apple-touch-icon" sizes="57x57" href="/apple-touch-icon-114.png">
+ <link rel="apple-touch-icon" sizes="114x114" href="/apple-touch-icon-114.png">
+ <link rel="apple-touch-icon" sizes="72x72" href="/apple-touch-icon-144.png">
+ <link rel="apple-touch-icon" sizes="144x144" href="/apple-touch-icon-144.png">
+ <meta property="fb:app_id" content="1401488693436528">
+
+ <meta content="@github" name="twitter:site" /><meta content="summary" name="twitter:card" /><meta content="DestructiveReasoning/Savant" name="twitter:title" /><meta content="Savant - CLI calculator with graphing functionality, including parametric and polar curves. Depends on SDL2 and OpenGL." name="twitter:description" /><meta content="https://avatars0.githubusercontent.com/u/7281569?v=3&amp;s=400" name="twitter:image:src" />
+ <meta content="GitHub" property="og:site_name" /><meta content="object" property="og:type" /><meta content="https://avatars0.githubusercontent.com/u/7281569?v=3&amp;s=400" property="og:image" /><meta content="DestructiveReasoning/Savant" property="og:title" /><meta content="https://github.com/DestructiveReasoning/Savant" property="og:url" /><meta content="Savant - CLI calculator with graphing functionality, including parametric and polar curves. Depends on SDL2 and OpenGL." property="og:description" />
+ <meta name="browser-stats-url" content="/_stats">
+ <link rel="assets" href="https://assets-cdn.github.com/">
+
+ <meta name="pjax-timeout" content="1000">
+
+
+ <meta name="msapplication-TileImage" content="/windows-tile.png">
+ <meta name="msapplication-TileColor" content="#ffffff">
+ <meta name="selected-link" value="repo_source" data-pjax-transient>
+ <meta name="google-analytics" content="UA-3769691-2">
+
+ <meta content="collector.githubapp.com" name="octolytics-host" /><meta content="collector-cdn.github.com" name="octolytics-script-host" /><meta content="github" name="octolytics-app-id" /><meta content="6017A85E:6DBA:D92A7:551777AF" name="octolytics-dimension-request_id" />
+
+ <meta content="Rails, view, files#disambiguate" name="analytics-event" />
+
+
+ <link rel="icon" type="image/x-icon" href="https://assets-cdn.github.com/favicon.ico">
+
+
+ <meta content="authenticity_token" name="csrf-param" />
+<meta content="eSLdG+03a8Eo5jdAeZ6F5rB8cJzQbvtgsUemvgR846xfFn6EkxaI4Sd/I4DGLiefImmkyZ3BBf5hGFaaCCn47g==" name="csrf-token" />
+
+ <link href="https://assets-cdn.github.com/assets/github-6337179a282bad7457c5b97336a91ca3743e26d9564ce4c54d4baef4163fc364.css" media="all" rel="stylesheet" />
+ <link href="https://assets-cdn.github.com/assets/github2-1b541813bef149ffc2f5118b0bfa467e9fe56083241b6a9f140d30ea692aefdc.css" media="all" rel="stylesheet" />
+
+
+
+
+ <meta http-equiv="x-pjax-version" content="f82dd05eac900f987444c3b4e32e7dab">
+
+
+ <meta name="description" content="Savant - CLI calculator with graphing functionality, including parametric and polar curves. Depends on SDL2 and OpenGL.">
+ <meta name="go-import" content="github.com/DestructiveReasoning/Savant git https://github.com/DestructiveReasoning/Savant.git">
+
+ <meta content="7281569" name="octolytics-dimension-user_id" /><meta content="DestructiveReasoning" name="octolytics-dimension-user_login" /><meta content="32181270" name="octolytics-dimension-repository_id" /><meta content="DestructiveReasoning/Savant" name="octolytics-dimension-repository_nwo" /><meta content="true" name="octolytics-dimension-repository_public" /><meta content="false" name="octolytics-dimension-repository_is_fork" /><meta content="32181270" name="octolytics-dimension-repository_network_root_id" /><meta content="DestructiveReasoning/Savant" name="octolytics-dimension-repository_network_root_nwo" />
+ <link href="https://github.com/DestructiveReasoning/savant/commits/master.atom" rel="alternate" title="Recent Commits to Savant:master" type="application/atom+xml">
+
+ </head>
+
+
+ <body class="logged_out env-production vis-public">
+ <a href="#start-of-content" tabindex="1" class="accessibility-aid js-skip-to-content">Skip to content</a>
+ <div class="wrapper">
+
+
+
+
+
+
+ <div class="header header-logged-out" role="banner">
+ <div class="container clearfix">
+
+ <a class="header-logo-wordmark" href="https://github.com/" data-ga-click="(Logged out) Header, go to homepage, icon:logo-wordmark">
+ <span class="mega-octicon octicon-logo-github"></span>
+ </a>
+
+ <div class="header-actions" role="navigation">
+ <a class="btn btn-primary" href="/join" data-ga-click="(Logged out) Header, clicked Sign up, text:sign-up">Sign up</a>
+ <a class="btn" href="/login?return_to=%2FDestructiveReasoning%2Fsavant" data-ga-click="(Logged out) Header, clicked Sign in, text:sign-in">Sign in</a>
+ </div>
+
+ <div class="site-search repo-scope js-site-search" role="search">
+ <form accept-charset="UTF-8" action="/DestructiveReasoning/Savant/search" class="js-site-search-form" data-global-search-url="/search" data-repo-search-url="/DestructiveReasoning/Savant/search" method="get"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /></div>
+ <input type="text"
+ class="js-site-search-field is-clearable"
+ data-hotkey="s"
+ name="q"
+ placeholder="Search"
+ data-global-scope-placeholder="Search GitHub"
+ data-repo-scope-placeholder="Search"
+ tabindex="1"
+ autocapitalize="off">
+ <div class="scope-badge">This repository</div>
+</form>
+ </div>
+
+ <ul class="header-nav left" role="navigation">
+ <li class="header-nav-item">
+ <a class="header-nav-link" href="/explore" data-ga-click="(Logged out) Header, go to explore, text:explore">Explore</a>
+ </li>
+ <li class="header-nav-item">
+ <a class="header-nav-link" href="/features" data-ga-click="(Logged out) Header, go to features, text:features">Features</a>
+ </li>
+ <li class="header-nav-item">
+ <a class="header-nav-link" href="https://enterprise.github.com/" data-ga-click="(Logged out) Header, go to enterprise, text:enterprise">Enterprise</a>
+ </li>
+ <li class="header-nav-item">
+ <a class="header-nav-link" href="/blog" data-ga-click="(Logged out) Header, go to blog, text:blog">Blog</a>
+ </li>
+ </ul>
+
+ </div>
+</div>
+
+
+
+ <div id="start-of-content" class="accessibility-aid"></div>
+ <div class="site" itemscope itemtype="http://schema.org/WebPage">
+ <div id="js-flash-container">
+
+ </div>
+ <div class="pagehead repohead instapaper_ignore readability-menu">
+ <div class="container">
+
+<ul class="pagehead-actions">
+
+ <li>
+ <a href="/login?return_to=%2FDestructiveReasoning%2FSavant"
+ class="btn btn-sm btn-with-count tooltipped tooltipped-n"
+ aria-label="You must be signed in to watch a repository" rel="nofollow">
+ <span class="octicon octicon-eye"></span>
+ Watch
+ </a>
+ <a class="social-count" href="/DestructiveReasoning/Savant/watchers">
+ 1
+ </a>
+
+ </li>
+
+ <li>
+ <a href="/login?return_to=%2FDestructiveReasoning%2FSavant"
+ class="btn btn-sm btn-with-count tooltipped tooltipped-n"
+ aria-label="You must be signed in to star a repository" rel="nofollow">
+ <span class="octicon octicon-star"></span>
+ Star
+ </a>
+
+ <a class="social-count js-social-count" href="/DestructiveReasoning/Savant/stargazers">
+ 0
+ </a>
+
+ </li>
+
+ <li>
+ <a href="/login?return_to=%2FDestructiveReasoning%2FSavant"
+ class="btn btn-sm btn-with-count tooltipped tooltipped-n"
+ aria-label="You must be signed in to fork a repository" rel="nofollow">
+ <span class="octicon octicon-repo-forked"></span>
+ Fork
+ </a>
+ <a href="/DestructiveReasoning/Savant/network" class="social-count">
+ 0
+ </a>
+ </li>
+</ul>
+
+ <h1 itemscope itemtype="http://data-vocabulary.org/Breadcrumb" class="entry-title public">
+ <span class="mega-octicon octicon-repo"></span>
+ <span class="author"><a href="/DestructiveReasoning" class="url fn" itemprop="url" rel="author"><span itemprop="title">DestructiveReasoning</span></a></span><!--
+ --><span class="path-divider">/</span><!--
+ --><strong><a href="/DestructiveReasoning/Savant" class="js-current-repository" data-pjax="#js-repo-pjax-container">Savant</a></strong>
+
+ <span class="page-context-loader">
+ <img alt="" height="16" src="https://assets-cdn.github.com/assets/spinners/octocat-spinner-32-e513294efa576953719e4e2de888dd9cf929b7d62ed8d05f25e731d02452ab6c.gif" width="16" />
+ </span>
+
+ </h1>
+ </div><!-- /.container -->
+ </div><!-- /.repohead -->
+
+ <div class="container">
+ <div class="repository-with-sidebar repo-container new-discussion-timeline with-full-navigation ">
+ <div class="repository-sidebar clearfix">
+
+<nav class="sunken-menu repo-nav js-repo-nav js-sidenav-container-pjax js-octicon-loaders"
+ role="navigation"
+ data-pjax="#js-repo-pjax-container"
+ data-issue-count-url="/DestructiveReasoning/Savant/issues/counts">
+ <ul class="sunken-menu-group">
+ <li class="tooltipped tooltipped-w" aria-label="Code">
+ <a href="/DestructiveReasoning/Savant" aria-label="Code" class="selected js-selected-navigation-item sunken-menu-item" data-hotkey="g c" data-selected-links="repo_source repo_downloads repo_commits repo_releases repo_tags repo_branches /DestructiveReasoning/Savant">
+ <span class="octicon octicon-code"></span> <span class="full-word">Code</span>
+ <img alt="" class="mini-loader" height="16" src="https://assets-cdn.github.com/assets/spinners/octocat-spinner-32-e513294efa576953719e4e2de888dd9cf929b7d62ed8d05f25e731d02452ab6c.gif" width="16" />
+</a> </li>
+
+ <li class="tooltipped tooltipped-w" aria-label="Issues">
+ <a href="/DestructiveReasoning/savant/issues" aria-label="Issues" class="js-selected-navigation-item sunken-menu-item" data-hotkey="g i" data-selected-links="repo_issues repo_labels repo_milestones /DestructiveReasoning/savant/issues">
+ <span class="octicon octicon-issue-opened"></span> <span class="full-word">Issues</span>
+ <span class="js-issue-replace-counter"></span>
+ <img alt="" class="mini-loader" height="16" src="https://assets-cdn.github.com/assets/spinners/octocat-spinner-32-e513294efa576953719e4e2de888dd9cf929b7d62ed8d05f25e731d02452ab6c.gif" width="16" />
+</a> </li>
+
+ <li class="tooltipped tooltipped-w" aria-label="Pull requests">
+ <a href="/DestructiveReasoning/savant/pulls" aria-label="Pull requests" class="js-selected-navigation-item sunken-menu-item" data-hotkey="g p" data-selected-links="repo_pulls /DestructiveReasoning/savant/pulls">
+ <span class="octicon octicon-git-pull-request"></span> <span class="full-word">Pull requests</span>
+ <span class="js-pull-replace-counter"></span>
+ <img alt="" class="mini-loader" height="16" src="https://assets-cdn.github.com/assets/spinners/octocat-spinner-32-e513294efa576953719e4e2de888dd9cf929b7d62ed8d05f25e731d02452ab6c.gif" width="16" />
+</a> </li>
+
+ </ul>
+ <div class="sunken-menu-separator"></div>
+ <ul class="sunken-menu-group">
+
+ <li class="tooltipped tooltipped-w" aria-label="Pulse">
+ <a href="/DestructiveReasoning/Savant/pulse" aria-label="Pulse" class="js-selected-navigation-item sunken-menu-item" data-selected-links="pulse /DestructiveReasoning/Savant/pulse">
+ <span class="octicon octicon-pulse"></span> <span class="full-word">Pulse</span>
+ <img alt="" class="mini-loader" height="16" src="https://assets-cdn.github.com/assets/spinners/octocat-spinner-32-e513294efa576953719e4e2de888dd9cf929b7d62ed8d05f25e731d02452ab6c.gif" width="16" />
+</a> </li>
+
+ <li class="tooltipped tooltipped-w" aria-label="Graphs">
+ <a href="/DestructiveReasoning/Savant/graphs" aria-label="Graphs" class="js-selected-navigation-item sunken-menu-item" data-selected-links="repo_graphs repo_contributors /DestructiveReasoning/Savant/graphs">
+ <span class="octicon octicon-graph"></span> <span class="full-word">Graphs</span>
+ <img alt="" class="mini-loader" height="16" src="https://assets-cdn.github.com/assets/spinners/octocat-spinner-32-e513294efa576953719e4e2de888dd9cf929b7d62ed8d05f25e731d02452ab6c.gif" width="16" />
+</a> </li>
+ </ul>
+
+
+</nav>
+
+ <div class="only-with-full-nav">
+
+<div class="clone-url open"
+ data-protocol-type="http"
+ data-url="/users/set_protocol?protocol_selector=http&amp;protocol_type=clone">
+ <h3><span class="text-emphasized">HTTPS</span> clone URL</h3>
+ <div class="input-group js-zeroclipboard-container">
+ <input type="text" class="input-mini input-monospace js-url-field js-zeroclipboard-target"
+ value="https://github.com/DestructiveReasoning/Savant.git" readonly="readonly">
+ <span class="input-group-button">
+ <button aria-label="Copy to clipboard" class="js-zeroclipboard btn btn-sm zeroclipboard-button" data-copied-hint="Copied!" type="button"><span class="octicon octicon-clippy"></span></button>
+ </span>
+ </div>
+</div>
+
+
+<div class="clone-url "
+ data-protocol-type="subversion"
+ data-url="/users/set_protocol?protocol_selector=subversion&amp;protocol_type=clone">
+ <h3><span class="text-emphasized">Subversion</span> checkout URL</h3>
+ <div class="input-group js-zeroclipboard-container">
+ <input type="text" class="input-mini input-monospace js-url-field js-zeroclipboard-target"
+ value="https://github.com/DestructiveReasoning/Savant" readonly="readonly">
+ <span class="input-group-button">
+ <button aria-label="Copy to clipboard" class="js-zeroclipboard btn btn-sm zeroclipboard-button" data-copied-hint="Copied!" type="button"><span class="octicon octicon-clippy"></span></button>
+ </span>
+ </div>
+</div>
+
+
+
+<p class="clone-options">You can clone with
+ <a href="#" class="js-clone-selector" data-protocol="http">HTTPS</a> or <a href="#" class="js-clone-selector" data-protocol="subversion">Subversion</a>.
+ <a href="https://help.github.com/articles/which-remote-url-should-i-use" class="help tooltipped tooltipped-n" aria-label="Get help on which URL is right for you.">
+ <span class="octicon octicon-question"></span>
+ </a>
+</p>
+
+
+
+ <a href="/DestructiveReasoning/Savant/archive/master.zip"
+ class="btn btn-sm sidebar-button"
+ aria-label="Download the contents of DestructiveReasoning/Savant as a zip file"
+ title="Download the contents of DestructiveReasoning/Savant as a zip file"
+ rel="nofollow">
+ <span class="octicon octicon-cloud-download"></span>
+ Download ZIP
+ </a>
+ </div>
+ </div><!-- /.repository-sidebar -->
+
+ <div id="js-repo-pjax-container" class="repository-content context-loader-container" data-pjax-container>
+
+<span id="js-show-full-navigation"></span>
+
+<div class="repository-meta js-details-container ">
+ <div class="repository-description">
+ CLI calculator with graphing functionality, including parametric and polar curves. Depends on SDL2 and OpenGL.
+ </div>
+
+
+
+</div>
+
+<div class="overall-summary overall-summary-bottomless">
+
+ <div class="stats-switcher-viewport js-stats-switcher-viewport">
+ <div class="stats-switcher-wrapper">
+ <ul class="numbers-summary">
+ <li class="commits">
+ <a data-pjax href="/DestructiveReasoning/Savant/commits/master">
+ <span class="octicon octicon-history"></span>
+ <span class="num text-emphasized">
+ 9
+ </span>
+ commits
+ </a>
+ </li>
+ <li>
+ <a data-pjax href="/DestructiveReasoning/Savant/branches">
+ <span class="octicon octicon-git-branch"></span>
+ <span class="num text-emphasized">
+ 1
+ </span>
+ branch
+ </a>
+ </li>
+
+ <li>
+ <a data-pjax href="/DestructiveReasoning/Savant/releases">
+ <span class="octicon octicon-tag"></span>
+ <span class="num text-emphasized">
+ 0
+ </span>
+ releases
+ </a>
+ </li>
+
+ <li>
+ <include-fragment src="/DestructiveReasoning/Savant/contributors_size">
+ <a href="/DestructiveReasoning/Savant/graphs/contributors">
+ <span class="octicon octicon-organization"></span>
+ <span class="num text-emphasized"></span>
+ Fetching contributors
+ </a>
+</include-fragment> </li>
+ </ul>
+
+ <div class="repository-lang-stats">
+ <ol class="repository-lang-stats-numbers">
+ <li>
+ <a href="/DestructiveReasoning/Savant/search?l=cpp">
+ <span class="color-block language-color" style="background-color:#f34b7d;"></span>
+ <span class="lang">C++</span>
+ <span class="percent">99.7%</span>
+ </a>
+ </li>
+ </ol>
+ </div>
+ </div>
+ </div>
+
+</div>
+
+ <div class="repository-lang-stats-graph js-toggle-lang-stats" title="Click for language details">
+ <span class="language-color" aria-label="C++ 99.7%" style="width:99.7%; background-color:#f34b7d;" itemprop="keywords">C++</span>
+ </div>
+
+<include-fragment src="/DestructiveReasoning/savant/show_partial?partial=recently_touched_branches_list"></include-fragment>
+
+<div class="file-navigation in-mid-page">
+ <a href="/DestructiveReasoning/Savant/find/master"
+ class="js-show-file-finder btn btn-sm empty-icon tooltipped tooltipped-s right"
+ data-pjax
+ data-hotkey="t"
+ aria-label="Quickly jump between files">
+ <span class="octicon octicon-list-unordered"></span>
+ </a>
+ <a href="/DestructiveReasoning/Savant/compare" aria-label="Compare, review, create a pull request" class="btn btn-sm btn-primary tooltipped tooltipped-s left compare-button" aria-label="Compare &amp; review" data-pjax data-ga-click="Repository, go to compare view, location:repo overview; icon:git-compare">
+ <span class="octicon octicon-git-compare"></span>
+ </a>
+
+
+<div class="select-menu js-menu-container js-select-menu left">
+ <span class="btn btn-sm select-menu-button js-menu-target css-truncate" data-hotkey="w"
+ data-master-branch="master"
+ data-ref="master"
+ title="master"
+ role="button" aria-label="Switch branches or tags" tabindex="0" aria-haspopup="true">
+ <span class="octicon octicon-git-branch"></span>
+ <i>branch:</i>
+ <span class="js-select-button css-truncate-target">master</span>
+ </span>
+
+ <div class="select-menu-modal-holder js-menu-content js-navigation-container" data-pjax aria-hidden="true">
+
+ <div class="select-menu-modal">
+ <div class="select-menu-header">
+ <span class="select-menu-title">Switch branches/tags</span>
+ <span class="octicon octicon-x js-menu-close" role="button" aria-label="Close"></span>
+ </div>
+
+ <div class="select-menu-filters">
+ <div class="select-menu-text-filter">
+ <input type="text" aria-label="Filter branches/tags" id="context-commitish-filter-field" class="js-filterable-field js-navigation-enable" placeholder="Filter branches/tags">
+ </div>
+ <div class="select-menu-tabs">
+ <ul>
+ <li class="select-menu-tab">
+ <a href="#" data-tab-filter="branches" data-filter-placeholder="Filter branches/tags" class="js-select-menu-tab">Branches</a>
+ </li>
+ <li class="select-menu-tab">
+ <a href="#" data-tab-filter="tags" data-filter-placeholder="Find a tag…" class="js-select-menu-tab">Tags</a>
+ </li>
+ </ul>
+ </div>
+ </div>
+
+ <div class="select-menu-list select-menu-tab-bucket js-select-menu-tab-bucket" data-tab-filter="branches">
+
+ <div data-filterable-for="context-commitish-filter-field" data-filterable-type="substring">
+
+
+ <a class="select-menu-item js-navigation-item js-navigation-open selected"
+ href="/DestructiveReasoning/savant/tree/master"
+ data-name="master"
+ data-skip-pjax="true"
+ rel="nofollow">
+ <span class="select-menu-item-icon octicon octicon-check"></span>
+ <span class="select-menu-item-text css-truncate-target" title="master">
+ master
+ </span>
+ </a>
+ </div>
+
+ <div class="select-menu-no-results">Nothing to show</div>
+ </div>
+
+ <div class="select-menu-list select-menu-tab-bucket js-select-menu-tab-bucket" data-tab-filter="tags">
+ <div data-filterable-for="context-commitish-filter-field" data-filterable-type="substring">
+
+
+ </div>
+
+ <div class="select-menu-no-results">Nothing to show</div>
+ </div>
+
+ </div>
+ </div>
+</div>
+
+
+
+ <div class="breadcrumb"><span class='repo-root js-repo-root'><span itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb"><a href="/DestructiveReasoning/Savant" class="" data-branch="master" data-direction="back" data-pjax="true" itemscope="url"><span itemprop="title">Savant</span></a></span></span><span class="separator">/</span>
+ <a class="btn-link disabled tooltipped tooltipped-e" href="#" aria-label="You must be signed in to make or propose changes">
+ <span class="octicon octicon-plus"></span>
+ </a>
+</div>
+</div>
+
+
+
+ <include-fragment class="commit commit-loader commit-tease" src="/DestructiveReasoning/Savant/tree-commit/12eb41d071fed6096cd4cd659dd4a6bf1c0aec05">
+ <p class="commit-title blank">
+ Fetching latest commit…
+ </p>
+ <div class="commit-meta">
+ <p class="loader-loading"><img alt="" height="16" src="https://assets-cdn.github.com/assets/spinners/octocat-spinner-32-EAF2F5-0bdc57d34b85c4a4de9d0d1db10cd70e8a95f33ff4f46c5a8c48b4bf4e5a9abe.gif" width="16" /></p>
+ <p class="loader-error">Cannot retrieve the latest commit at this time</p>
+ </div>
+</include-fragment>
+
+<div class="file-wrap">
+
+ <table class="files" data-pjax>
+
+
+ <tbody>
+ <tr class="warning include-fragment-error">
+ <td class="icon"><span class="octicon octicon-alert"></span></td>
+ <td class="content" colspan="3">Failed to load latest commit information.</td>
+ </tr>
+
+ <tr>
+ <td class="icon">
+ <span class="octicon octicon-file-text"></span>
+ <img alt="" class="spinner" height="16" src="https://assets-cdn.github.com/assets/spinners/octocat-spinner-32-e513294efa576953719e4e2de888dd9cf929b7d62ed8d05f25e731d02452ab6c.gif" width="16" />
+ </td>
+ <td class="content">
+ <span class="css-truncate css-truncate-target"><a href="/DestructiveReasoning/Savant/blob/master/Math.cpp" class="js-directory-link" id="a729655184a0d2241d1627015898c08f-1a78f9109aac911c6613f257919bb07f45773a43" title="Math.cpp">Math.cpp</a></span>
+ </td>
+ <td class="message">
+ <span class="css-truncate css-truncate-target">
+ <a href="/DestructiveReasoning/Savant/commit/12eb41d071fed6096cd4cd659dd4a6bf1c0aec05" class="message" data-pjax="true" title="Removed some annoying outputs">Removed some annoying outputs</a>
+ </span>
+ </td>
+ <td class="age">
+ <span class="css-truncate css-truncate-target"><time datetime="2015-03-28T22:09:59Z" is="time-ago">Mar 28, 2015</time></span>
+ </td>
+ </tr>
+ <tr>
+ <td class="icon">
+ <span class="octicon octicon-file-text"></span>
+ <img alt="" class="spinner" height="16" src="https://assets-cdn.github.com/assets/spinners/octocat-spinner-32-e513294efa576953719e4e2de888dd9cf929b7d62ed8d05f25e731d02452ab6c.gif" width="16" />
+ </td>
+ <td class="content">
+ <span class="css-truncate css-truncate-target"><a href="/DestructiveReasoning/Savant/blob/master/Math.h" class="js-directory-link" id="934bb55c21fccc0c86d1ee608d3efa8e-f06b0713263cd790e6e327718b8c785aa0db1395" title="Math.h">Math.h</a></span>
+ </td>
+ <td class="message">
+ <span class="css-truncate css-truncate-target">
+ <a href="/DestructiveReasoning/Savant/commit/66b35c1c56b4a0b6f306bf6548d0a75b5abcd95a" class="message" data-pjax="true" title="Fixed some loose ends">Fixed some loose ends</a>
+ </span>
+ </td>
+ <td class="age">
+ <span class="css-truncate css-truncate-target"><time datetime="2015-03-28T22:08:30Z" is="time-ago">Mar 28, 2015</time></span>
+ </td>
+ </tr>
+ <tr>
+ <td class="icon">
+ <span class="octicon octicon-file-text"></span>
+ <img alt="" class="spinner" height="16" src="https://assets-cdn.github.com/assets/spinners/octocat-spinner-32-e513294efa576953719e4e2de888dd9cf929b7d62ed8d05f25e731d02452ab6c.gif" width="16" />
+ </td>
+ <td class="content">
+ <span class="css-truncate css-truncate-target"><a href="/DestructiveReasoning/Savant/blob/master/SDLCartesian.cpp" class="js-directory-link" id="238c1961e76d1d93a13a11db2aff9e40-3b0730ce2e595ff1d70fa188a3d26a9bce3502ea" title="SDLCartesian.cpp">SDLCartesian.cpp</a></span>
+ </td>
+ <td class="message">
+ <span class="css-truncate css-truncate-target">
+ <a href="/DestructiveReasoning/Savant/commit/5501684dda3debd2ec1a16089ed74298d46b0510" class="message" data-pjax="true" title="Cartesian Graph Maneuverability">Cartesian Graph Maneuverability</a>
+ </span>
+ </td>
+ <td class="age">
+ <span class="css-truncate css-truncate-target"><time datetime="2015-03-15T15:22:45Z" is="time-ago">Mar 15, 2015</time></span>
+ </td>
+ </tr>
+ <tr>
+ <td class="icon">
+ <span class="octicon octicon-file-text"></span>
+ <img alt="" class="spinner" height="16" src="https://assets-cdn.github.com/assets/spinners/octocat-spinner-32-e513294efa576953719e4e2de888dd9cf929b7d62ed8d05f25e731d02452ab6c.gif" width="16" />
+ </td>
+ <td class="content">
+ <span class="css-truncate css-truncate-target"><a href="/DestructiveReasoning/Savant/blob/master/SDLCartesian.h" class="js-directory-link" id="520c478ad32adb23bac2ba7dd2554c97-1f77ed6d06440e5c07ba7935569842e20b1cd8c9" title="SDLCartesian.h">SDLCartesian.h</a></span>
+ </td>
+ <td class="message">
+ <span class="css-truncate css-truncate-target">
+ <a href="/DestructiveReasoning/Savant/commit/949d5957ae02ae40cbe0e6d11bec1628d8d81900" class="message" data-pjax="true" title="Polar Curve Functionality">Polar Curve Functionality</a>
+ </span>
+ </td>
+ <td class="age">
+ <span class="css-truncate css-truncate-target"><time datetime="2015-03-15T21:12:45Z" is="time-ago">Mar 15, 2015</time></span>
+ </td>
+ </tr>
+ <tr>
+ <td class="icon">
+ <span class="octicon octicon-file-text"></span>
+ <img alt="" class="spinner" height="16" src="https://assets-cdn.github.com/assets/spinners/octocat-spinner-32-e513294efa576953719e4e2de888dd9cf929b7d62ed8d05f25e731d02452ab6c.gif" width="16" />
+ </td>
+ <td class="content">
+ <span class="css-truncate css-truncate-target"><a href="/DestructiveReasoning/Savant/blob/master/SDLParametric2.cpp" class="js-directory-link" id="392d58152435bb27161c6f0212e5087c-2c3896d25c1de70ea2006f10db15d569e3eee3f4" title="SDLParametric2.cpp">SDLParametric2.cpp</a></span>
+ </td>
+ <td class="message">
+ <span class="css-truncate css-truncate-target">
+ <a href="/DestructiveReasoning/Savant/commit/1d1dc4d7ca7864b8a2279b0ee29938a9fd9a1241" class="message" data-pjax="true" title="2D Parametric Equation Graphing">2D Parametric Equation Graphing</a>
+ </span>
+ </td>
+ <td class="age">
+ <span class="css-truncate css-truncate-target"><time datetime="2015-03-16T16:56:35Z" is="time-ago">Mar 16, 2015</time></span>
+ </td>
+ </tr>
+ <tr>
+ <td class="icon">
+ <span class="octicon octicon-file-text"></span>
+ <img alt="" class="spinner" height="16" src="https://assets-cdn.github.com/assets/spinners/octocat-spinner-32-e513294efa576953719e4e2de888dd9cf929b7d62ed8d05f25e731d02452ab6c.gif" width="16" />
+ </td>
+ <td class="content">
+ <span class="css-truncate css-truncate-target"><a href="/DestructiveReasoning/Savant/blob/master/SDLParametric2.h" class="js-directory-link" id="8ddae35c3cbd7ec14d1d9f9eeed2c8c3-64890163ee71b4ec178d40888ec80de08b548b8b" title="SDLParametric2.h">SDLParametric2.h</a></span>
+ </td>
+ <td class="message">
+ <span class="css-truncate css-truncate-target">
+ <a href="/DestructiveReasoning/Savant/commit/1d1dc4d7ca7864b8a2279b0ee29938a9fd9a1241" class="message" data-pjax="true" title="2D Parametric Equation Graphing">2D Parametric Equation Graphing</a>
+ </span>
+ </td>
+ <td class="age">
+ <span class="css-truncate css-truncate-target"><time datetime="2015-03-16T16:56:35Z" is="time-ago">Mar 16, 2015</time></span>
+ </td>
+ </tr>
+ <tr>
+ <td class="icon">
+ <span class="octicon octicon-file-text"></span>
+ <img alt="" class="spinner" height="16" src="https://assets-cdn.github.com/assets/spinners/octocat-spinner-32-e513294efa576953719e4e2de888dd9cf929b7d62ed8d05f25e731d02452ab6c.gif" width="16" />
+ </td>
+ <td class="content">
+ <span class="css-truncate css-truncate-target"><a href="/DestructiveReasoning/Savant/blob/master/SDLPolar.cpp" class="js-directory-link" id="36e89650bc7676e02a1cd06c16859d17-441bed26b5b69f8e89676b691289ec1e47c5c4e6" title="SDLPolar.cpp">SDLPolar.cpp</a></span>
+ </td>
+ <td class="message">
+ <span class="css-truncate css-truncate-target">
+ <a href="/DestructiveReasoning/Savant/commit/949d5957ae02ae40cbe0e6d11bec1628d8d81900" class="message" data-pjax="true" title="Polar Curve Functionality">Polar Curve Functionality</a>
+ </span>
+ </td>
+ <td class="age">
+ <span class="css-truncate css-truncate-target"><time datetime="2015-03-15T21:12:45Z" is="time-ago">Mar 15, 2015</time></span>
+ </td>
+ </tr>
+ <tr>
+ <td class="icon">
+ <span class="octicon octicon-file-text"></span>
+ <img alt="" class="spinner" height="16" src="https://assets-cdn.github.com/assets/spinners/octocat-spinner-32-e513294efa576953719e4e2de888dd9cf929b7d62ed8d05f25e731d02452ab6c.gif" width="16" />
+ </td>
+ <td class="content">
+ <span class="css-truncate css-truncate-target"><a href="/DestructiveReasoning/Savant/blob/master/SDLPolar.h" class="js-directory-link" id="485da36e868aba3e0a5e244f2d68fe04-8ed37c868a5513c3e715d3e00c520b22352bfb9b" title="SDLPolar.h">SDLPolar.h</a></span>
+ </td>
+ <td class="message">
+ <span class="css-truncate css-truncate-target">
+ <a href="/DestructiveReasoning/Savant/commit/949d5957ae02ae40cbe0e6d11bec1628d8d81900" class="message" data-pjax="true" title="Polar Curve Functionality">Polar Curve Functionality</a>
+ </span>
+ </td>
+ <td class="age">
+ <span class="css-truncate css-truncate-target"><time datetime="2015-03-15T21:12:45Z" is="time-ago">Mar 15, 2015</time></span>
+ </td>
+ </tr>
+ <tr>
+ <td class="icon">
+ <span class="octicon octicon-file-text"></span>
+ <img alt="" class="spinner" height="16" src="https://assets-cdn.github.com/assets/spinners/octocat-spinner-32-e513294efa576953719e4e2de888dd9cf929b7d62ed8d05f25e731d02452ab6c.gif" width="16" />
+ </td>
+ <td class="content">
+ <span class="css-truncate css-truncate-target"><a href="/DestructiveReasoning/Savant/blob/master/Source.cpp" class="js-directory-link" id="227ef4379f754f342096b3f59090d1d4-c3d6fe504dc64313a0b136ee5baf19cd5aceb35e" title="Source.cpp">Source.cpp</a></span>
+ </td>
+ <td class="message">
+ <span class="css-truncate css-truncate-target">
+ <a href="/DestructiveReasoning/Savant/commit/66b35c1c56b4a0b6f306bf6548d0a75b5abcd95a" class="message" data-pjax="true" title="Fixed some loose ends">Fixed some loose ends</a>
+ </span>
+ </td>
+ <td class="age">
+ <span class="css-truncate css-truncate-target"><time datetime="2015-03-28T22:08:30Z" is="time-ago">Mar 28, 2015</time></span>
+ </td>
+ </tr>
+ <tr>
+ <td class="icon">
+ <span class="octicon octicon-file-text"></span>
+ <img alt="" class="spinner" height="16" src="https://assets-cdn.github.com/assets/spinners/octocat-spinner-32-e513294efa576953719e4e2de888dd9cf929b7d62ed8d05f25e731d02452ab6c.gif" width="16" />
+ </td>
+ <td class="content">
+ <span class="css-truncate css-truncate-target"><a href="/DestructiveReasoning/Savant/blob/master/Txt.cpp" class="js-directory-link" id="3f50a70f5081c305ff615ec934ef9d85-50d953d19abeba4e21317d2beedf5cf8ef97a4c1" title="Txt.cpp">Txt.cpp</a></span>
+ </td>
+ <td class="message">
+ <span class="css-truncate css-truncate-target">
+ <a href="/DestructiveReasoning/Savant/commit/f2adbcc7574289d576960375fe65b95e9140f69d" class="message" data-pjax="true" title="Functional Calculator">Functional Calculator</a>
+ </span>
+ </td>
+ <td class="age">
+ <span class="css-truncate css-truncate-target"><time datetime="2015-03-13T15:55:52Z" is="time-ago">Mar 13, 2015</time></span>
+ </td>
+ </tr>
+ <tr>
+ <td class="icon">
+ <span class="octicon octicon-file-text"></span>
+ <img alt="" class="spinner" height="16" src="https://assets-cdn.github.com/assets/spinners/octocat-spinner-32-e513294efa576953719e4e2de888dd9cf929b7d62ed8d05f25e731d02452ab6c.gif" width="16" />
+ </td>
+ <td class="content">
+ <span class="css-truncate css-truncate-target"><a href="/DestructiveReasoning/Savant/blob/master/Txt.h" class="js-directory-link" id="c6311733470e6b261ee3ead6a03713de-46d15aa2f1500b46d5058b116aab9047da9157ac" title="Txt.h">Txt.h</a></span>
+ </td>
+ <td class="message">
+ <span class="css-truncate css-truncate-target">
+ <a href="/DestructiveReasoning/Savant/commit/f2adbcc7574289d576960375fe65b95e9140f69d" class="message" data-pjax="true" title="Functional Calculator">Functional Calculator</a>
+ </span>
+ </td>
+ <td class="age">
+ <span class="css-truncate css-truncate-target"><time datetime="2015-03-13T15:55:52Z" is="time-ago">Mar 13, 2015</time></span>
+ </td>
+ </tr>
+ <tr>
+ <td class="icon">
+ <span class="octicon octicon-file-text"></span>
+ <img alt="" class="spinner" height="16" src="https://assets-cdn.github.com/assets/spinners/octocat-spinner-32-e513294efa576953719e4e2de888dd9cf929b7d62ed8d05f25e731d02452ab6c.gif" width="16" />
+ </td>
+ <td class="content">
+ <span class="css-truncate css-truncate-target"><a href="/DestructiveReasoning/Savant/blob/master/a.out" class="js-directory-link" id="5dea70ffcfe47719904eb37cf7b21591-47e9a52c5afc6a933a58520d2aee27784ece4385" title="a.out">a.out</a></span>
+ </td>
+ <td class="message">
+ <span class="css-truncate css-truncate-target">
+ <a href="/DestructiveReasoning/Savant/commit/12eb41d071fed6096cd4cd659dd4a6bf1c0aec05" class="message" data-pjax="true" title="Removed some annoying outputs">Removed some annoying outputs</a>
+ </span>
+ </td>
+ <td class="age">
+ <span class="css-truncate css-truncate-target"><time datetime="2015-03-28T22:09:59Z" is="time-ago">Mar 28, 2015</time></span>
+ </td>
+ </tr>
+ <tr>
+ <td class="icon">
+ <span class="octicon octicon-file-text"></span>
+ <img alt="" class="spinner" height="16" src="https://assets-cdn.github.com/assets/spinners/octocat-spinner-32-e513294efa576953719e4e2de888dd9cf929b7d62ed8d05f25e731d02452ab6c.gif" width="16" />
+ </td>
+ <td class="content">
+ <span class="css-truncate css-truncate-target"><a href="/DestructiveReasoning/Savant/blob/master/destructive_reasoning.h" class="js-directory-link" id="ba12ed1c275dfe784068eed2c98d0246-302ddf944091847ab9c48a367cdf58e2cf181dd0" title="destructive_reasoning.h">destructive_reasoning.h</a></span>
+ </td>
+ <td class="message">
+ <span class="css-truncate css-truncate-target">
+ <a href="/DestructiveReasoning/Savant/commit/66b35c1c56b4a0b6f306bf6548d0a75b5abcd95a" class="message" data-pjax="true" title="Fixed some loose ends">Fixed some loose ends</a>
+ </span>
+ </td>
+ <td class="age">
+ <span class="css-truncate css-truncate-target"><time datetime="2015-03-28T22:08:30Z" is="time-ago">Mar 28, 2015</time></span>
+ </td>
+ </tr>
+ <tr>
+ <td class="icon">
+ <span class="octicon octicon-file-text"></span>
+ <img alt="" class="spinner" height="16" src="https://assets-cdn.github.com/assets/spinners/octocat-spinner-32-e513294efa576953719e4e2de888dd9cf929b7d62ed8d05f25e731d02452ab6c.gif" width="16" />
+ </td>
+ <td class="content">
+ <span class="css-truncate css-truncate-target"><a href="/DestructiveReasoning/Savant/blob/master/makefile" class="js-directory-link" id="cd5dbf3629c558b0104ba8f0937d6816-07a5d3fe43f605f2adb2caf046bc3d9d3aeccc23" title="makefile">makefile</a></span>
+ </td>
+ <td class="message">
+ <span class="css-truncate css-truncate-target">
+ <a href="/DestructiveReasoning/Savant/commit/8c061378a7347b4a6cda6673fd026fddbd9c48fe" class="message" data-pjax="true" title="Basic Graphing Functionality">Basic Graphing Functionality</a>
+ </span>
+ </td>
+ <td class="age">
+ <span class="css-truncate css-truncate-target"><time datetime="2015-03-15T12:24:46Z" is="time-ago">Mar 15, 2015</time></span>
+ </td>
+ </tr>
+ <tr>
+ <td class="icon">
+ <span class="octicon octicon-file-text"></span>
+ <img alt="" class="spinner" height="16" src="https://assets-cdn.github.com/assets/spinners/octocat-spinner-32-e513294efa576953719e4e2de888dd9cf929b7d62ed8d05f25e731d02452ab6c.gif" width="16" />
+ </td>
+ <td class="content">
+ <span class="css-truncate css-truncate-target"><a href="/DestructiveReasoning/Savant/blob/master/variable.cpp" class="js-directory-link" id="7ea976bd48d4aa47235606b7b82c82bb-08b0636e4bd3ac0e5f324e2b5bcc48ac23cffc53" title="variable.cpp">variable.cpp</a></span>
+ </td>
+ <td class="message">
+ <span class="css-truncate css-truncate-target">
+ <a href="/DestructiveReasoning/Savant/commit/f2adbcc7574289d576960375fe65b95e9140f69d" class="message" data-pjax="true" title="Functional Calculator">Functional Calculator</a>
+ </span>
+ </td>
+ <td class="age">
+ <span class="css-truncate css-truncate-target"><time datetime="2015-03-13T15:55:52Z" is="time-ago">Mar 13, 2015</time></span>
+ </td>
+ </tr>
+ <tr>
+ <td class="icon">
+ <span class="octicon octicon-file-text"></span>
+ <img alt="" class="spinner" height="16" src="https://assets-cdn.github.com/assets/spinners/octocat-spinner-32-e513294efa576953719e4e2de888dd9cf929b7d62ed8d05f25e731d02452ab6c.gif" width="16" />
+ </td>
+ <td class="content">
+ <span class="css-truncate css-truncate-target"><a href="/DestructiveReasoning/Savant/blob/master/variable.h" class="js-directory-link" id="4e719ee4954adbca46f09a778b0b8bce-e49f8de833bddc7b0053429d7e0cb1be3dfbfdf2" title="variable.h">variable.h</a></span>
+ </td>
+ <td class="message">
+ <span class="css-truncate css-truncate-target">
+ <a href="/DestructiveReasoning/Savant/commit/f2adbcc7574289d576960375fe65b95e9140f69d" class="message" data-pjax="true" title="Functional Calculator">Functional Calculator</a>
+ </span>
+ </td>
+ <td class="age">
+ <span class="css-truncate css-truncate-target"><time datetime="2015-03-13T15:55:52Z" is="time-ago">Mar 13, 2015</time></span>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+
+</div>
+
+
+
+
+
+ </div>
+
+ </div><!-- /.repo-container -->
+ <div class="modal-backdrop"></div>
+ </div><!-- /.container -->
+ </div><!-- /.site -->
+
+
+ </div><!-- /.wrapper -->
+
+ <div class="container">
+ <div class="site-footer" role="contentinfo">
+ <ul class="site-footer-links right">
+ <li><a href="https://status.github.com/" data-ga-click="Footer, go to status, text:status">Status</a></li>
+ <li><a href="https://developer.github.com" data-ga-click="Footer, go to api, text:api">API</a></li>
+ <li><a href="https://training.github.com" data-ga-click="Footer, go to training, text:training">Training</a></li>
+ <li><a href="https://shop.github.com" data-ga-click="Footer, go to shop, text:shop">Shop</a></li>
+ <li><a href="https://github.com/blog" data-ga-click="Footer, go to blog, text:blog">Blog</a></li>
+ <li><a href="https://github.com/about" data-ga-click="Footer, go to about, text:about">About</a></li>
+
+ </ul>
+
+ <a href="https://github.com" aria-label="Homepage">
+ <span class="mega-octicon octicon-mark-github" title="GitHub"></span>
+</a>
+ <ul class="site-footer-links">
+ <li>&copy; 2015 <span title="0.05477s from github-fe143-cp1-prd.iad.github.net">GitHub</span>, Inc.</li>
+ <li><a href="https://github.com/site/terms" data-ga-click="Footer, go to terms, text:terms">Terms</a></li>
+ <li><a href="https://github.com/site/privacy" data-ga-click="Footer, go to privacy, text:privacy">Privacy</a></li>
+ <li><a href="https://github.com/security" data-ga-click="Footer, go to security, text:security">Security</a></li>
+ <li><a href="https://github.com/contact" data-ga-click="Footer, go to contact, text:contact">Contact</a></li>
+ </ul>
+ </div>
+</div>
+
+
+ <div class="fullscreen-overlay js-fullscreen-overlay" id="fullscreen_overlay">
+ <div class="fullscreen-container js-suggester-container">
+ <div class="textarea-wrap">
+ <textarea name="fullscreen-contents" id="fullscreen-contents" class="fullscreen-contents js-fullscreen-contents" placeholder=""></textarea>
+ <div class="suggester-container">
+ <div class="suggester fullscreen-suggester js-suggester js-navigation-container"></div>
+ </div>
+ </div>
+ </div>
+ <div class="fullscreen-sidebar">
+ <a href="#" class="exit-fullscreen js-exit-fullscreen tooltipped tooltipped-w" aria-label="Exit Zen Mode">
+ <span class="mega-octicon octicon-screen-normal"></span>
+ </a>
+ <a href="#" class="theme-switcher js-theme-switcher tooltipped tooltipped-w"
+ aria-label="Switch themes">
+ <span class="octicon octicon-color-mode"></span>
+ </a>
+ </div>
+</div>
+
+
+
+
+
+
+ <div id="ajax-error-message" class="flash flash-error">
+ <span class="octicon octicon-alert"></span>
+ <a href="#" class="octicon octicon-x flash-close js-ajax-error-dismiss" aria-label="Dismiss error"></a>
+ Something went wrong with that request. Please try again.
+ </div>
+
+
+ <script crossorigin="anonymous" src="https://assets-cdn.github.com/assets/frameworks-d22b59d0085e83b7549ba4341ec9e68f80c2f29c8e49213ee182003dc8d568c6.js"></script>
+ <script async="async" crossorigin="anonymous" src="https://assets-cdn.github.com/assets/github-d869f6edeea2dbd9c7c3595e2f31cf8a1530bd36eaa84707461f65c5ee848853.js"></script>
+
+
+
+ </body>
+</html>
+
diff --git a/savant-git-0.1.3-1-any.pkg.tar.xz b/savant-git-0.1.3-1-any.pkg.tar.xz
new file mode 100644
index 000000000000..27f629ac9387
--- /dev/null
+++ b/savant-git-0.1.3-1-any.pkg.tar.xz
Binary files differ
diff --git a/savant-git-0.1.3-1.src.tar.gz b/savant-git-0.1.3-1.src.tar.gz
new file mode 100644
index 000000000000..b5c0dc75f7e9
--- /dev/null
+++ b/savant-git-0.1.3-1.src.tar.gz
Binary files differ
diff --git a/savant-git-0.1.4-1.src.tar.gz b/savant-git-0.1.4-1.src.tar.gz
new file mode 100644
index 000000000000..d9f2ec92d64c
--- /dev/null
+++ b/savant-git-0.1.4-1.src.tar.gz
Binary files differ
diff --git a/savant-git-0.1.5-1.src.tar.gz b/savant-git-0.1.5-1.src.tar.gz
new file mode 100644
index 000000000000..de5a8d4e6044
--- /dev/null
+++ b/savant-git-0.1.5-1.src.tar.gz
Binary files differ
diff --git a/savant-git-0.2.0-1.src.tar.gz b/savant-git-0.2.0-1.src.tar.gz
new file mode 100644
index 000000000000..4acecc0ce970
--- /dev/null
+++ b/savant-git-0.2.0-1.src.tar.gz
Binary files differ
diff --git a/savant-git-0.2.1-1.src.tar.gz b/savant-git-0.2.1-1.src.tar.gz
new file mode 100644
index 000000000000..195b43d0f61b
--- /dev/null
+++ b/savant-git-0.2.1-1.src.tar.gz
Binary files differ
diff --git a/savant-git-0.2.2-1.src.tar.gz b/savant-git-0.2.2-1.src.tar.gz
new file mode 100644
index 000000000000..502d9f59d706
--- /dev/null
+++ b/savant-git-0.2.2-1.src.tar.gz
Binary files differ
diff --git a/savant-git-0.2.3-1.src.tar.gz b/savant-git-0.2.3-1.src.tar.gz
new file mode 100644
index 000000000000..65509bdf93fc
--- /dev/null
+++ b/savant-git-0.2.3-1.src.tar.gz
Binary files differ
diff --git a/savant-git-0.3.0-1.src.tar.gz b/savant-git-0.3.0-1.src.tar.gz
new file mode 100644
index 000000000000..750a255be079
--- /dev/null
+++ b/savant-git-0.3.0-1.src.tar.gz
Binary files differ
diff --git a/savant-git.install b/savant-git.install
new file mode 100644
index 000000000000..2eaa60550d51
--- /dev/null
+++ b/savant-git.install
@@ -0,0 +1,11 @@
+post_install() {
+ update-desktop-database -q
+}
+
+post_upgrade() {
+ post_install $1
+}
+
+post_remove() {
+ post_install $1
+}
diff --git a/savanttest-git-0.1.3-1-any.pkg.tar.xz b/savanttest-git-0.1.3-1-any.pkg.tar.xz
new file mode 100644
index 000000000000..e7789251bcf5
--- /dev/null
+++ b/savanttest-git-0.1.3-1-any.pkg.tar.xz
Binary files differ
diff --git a/savanttest-git-0.1.3-1.src.tar.gz b/savanttest-git-0.1.3-1.src.tar.gz
new file mode 100644
index 000000000000..196d2d69e133
--- /dev/null
+++ b/savanttest-git-0.1.3-1.src.tar.gz
Binary files differ
diff --git a/variable.cpp b/variable.cpp
new file mode 100644
index 000000000000..08b0636e4bd3
--- /dev/null
+++ b/variable.cpp
@@ -0,0 +1,16 @@
+#include "variable.h"
+
+std::string Variable::getName()
+{
+ return name;
+}
+
+double Variable::getValue()
+{
+ return value;
+}
+
+void Variable::setValue(double val)
+{
+ value = val;
+}
diff --git a/variable.h b/variable.h
new file mode 100644
index 000000000000..9a531a58a388
--- /dev/null
+++ b/variable.h
@@ -0,0 +1,22 @@
+#ifndef _VARIABLE_H_
+#define _VARIABLE_H_
+
+#include "destructive_reasoning.h"
+
+class Variable
+{
+ public:
+ Variable(std::string n, double v, bool isConstant) : name(n), value(v), constant(isConstant) {};
+ std::string getName();
+ double getValue();
+ inline bool isConstant() { return constant; };
+
+ void setValue(double val);
+
+ private:
+ std::string name;
+ double value;
+ bool constant;
+};
+
+#endif