summarylogtreecommitdiffstats
path: root/0006-analog_values.patch
diff options
context:
space:
mode:
authorMelvin Vermeeren2016-02-22 21:02:43 +0100
committerMelvin Vermeeren2016-02-22 21:03:14 +0100
commit9ce0e7952cbaca0891c995863505e5a57e735ce9 (patch)
tree531c4f4a3417cc1f12b0f4683de1068d8781c56b /0006-analog_values.patch
downloadaur-9ce0e7952cbaca0891c995863505e5a57e735ce9.tar.gz
DrawTiming 0.7.1 with patches.
Diffstat (limited to '0006-analog_values.patch')
-rw-r--r--0006-analog_values.patch105
1 files changed, 105 insertions, 0 deletions
diff --git a/0006-analog_values.patch b/0006-analog_values.patch
new file mode 100644
index 000000000000..acaf61eacca7
--- /dev/null
+++ b/0006-analog_values.patch
@@ -0,0 +1,105 @@
+Index: src/timing.cc
+===================================================================
+--- src/timing.cc (revision 76)
++++ src/timing.cc (working copy)
+@@ -18,6 +18,7 @@
+ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+ #include "timing.h"
++#include "string.h"
+ #include <map>
+ #include <fstream>
+ using namespace std;
+@@ -61,21 +62,40 @@
+ sigvalue::sigvalue (const std::string &s, valuetype n) {
+ text = s;
+ type = n;
+- if (type == UNDEF) {
+- if (text == "0" || text == "false")
++ if (type == UNDEF) {
++ if (text == "0" || text == "false") {
+ type = ZERO;
+- else if (text == "1" || text == "true")
++ val = 0.0;
++ } else if (text == "1" || text == "true") {
+ type = ONE;
+- else if (text == "pulse")
++ val = 1.0;
++ } else if (text == "pulse") {
+ type = PULSE;
+- else if (text == "tick")
++ val = 0.0;
++ } else if (text == "tick") {
+ type = TICK;
+- else if (text == "X")
++ val = 0.0;
++ } else if (text == "X") {
+ type = X;
+- else if (text == "Z")
++ val = 0.5;
++ } else if (text == "Z") {
+ type = Z;
+- else
+- type = STATE;
++ val = 0.5;
++ } else {
++ float ana;
++ int n = sscanf(text.c_str(), "%f", &ana);
++ if(n > 0) {
++ val = ana;
++ if(text[text.length()-1] == 'S') {
++ type = ANA_STEP;
++ } else {
++ type = ANA;
++ }
++ } else {
++ type = STATE;
++ val = 0.5;
++ }
++ }
+ }
+ }
+
+@@ -84,6 +104,7 @@
+ sigvalue &sigvalue::operator= (const sigvalue &t) {
+ type = t.type;
+ text = t.text;
++ val = t.val;
+ return *this;
+ }
+
+@@ -338,6 +359,16 @@
+ const sigvalue &value) {
+
+ switch (value.type) {
++
++ case ANA:
++ gc.line(x, y + (int) (vCellH * (1.0 - last.val)), x+vCellW, y + (int) (vCellH * (1.0 - value.val)));
++ break;
++
++ case ANA_STEP:
++ gc.line(x, y + (int) (vCellH * (1.0 - last.val)), x, y + (int) (vCellH * (1.0 - value.val)));
++ gc.line(x, y + (int) (vCellH * (1.0 - value.val)), x+vCellW, y + (int) (vCellH * (1.0 - value.val)));
++ break;
++
+ case ZERO:
+ switch (last.type) {
+ default:
+Index: src/timing.h
+===================================================================
+--- src/timing.h (revision 76)
++++ src/timing.h (working copy)
+@@ -29,11 +29,12 @@
+
+ namespace timing {
+
+- enum valuetype {UNDEF, ZERO, ONE, X, Z, PULSE, TICK, STATE};
++ enum valuetype {UNDEF, ZERO, ONE, X, Z, PULSE, TICK, STATE, ANA, ANA_STEP};
+
+ struct sigvalue {
+ valuetype type;
+ std::string text;
++ float val;
+ sigvalue (void);
+ sigvalue (const sigvalue &);
+ sigvalue (const std::string &s, valuetype n = UNDEF);