From 8c121d944aafa0b682030156f6c5dd743dfab607 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 3 Feb 2020 00:00:55 -0500 Subject: get the simple + arithmetic operation strings right --- rrdformat/op_string.go | 6 +- rrdformat/rpn.go | 159 +++++++++++++++++++++++++++---------------------- 2 files changed, 91 insertions(+), 74 deletions(-) diff --git a/rrdformat/op_string.go b/rrdformat/op_string.go index 4ec909b..9631f92 100644 --- a/rrdformat/op_string.go +++ b/rrdformat/op_string.go @@ -1,4 +1,4 @@ -// Code generated by "stringer -type=Op -trimprefix=OP_"; DO NOT EDIT. +// Code generated by "stringer -type=Op -trimprefix=OP_ -linecomment"; DO NOT EDIT. package rrdformat @@ -80,9 +80,9 @@ func _() { _ = x[OP_POW-69] } -const _Op_name = "NUMBERVARIABLEINFPREVNEGINFUNKNNOWTIMEADDMODSUBMULDIVSINDUPEXCPOPCOSLOGEXPLTLEGTGEEQIFMINMAXLIMITFLOORCEILUNENDLTIMENEISINFPREV_OTHERCOUNTATANSQRTSORTREVTRENDTRENDNANATAN2RAD2DEGDEG2RADPREDICTPREDICTSIGMAAVGABSADDNANMINNANMAXNANMEDIANPREDICTPERCDEPTHCOPYROLLINDEXSTEPWIDTHNEWDAYNEWWEEKNEWMONTHNEWYEARSMINSMAXSTDEVPERCENTPOW" +const _Op_name = "NUMBERVARIABLEINFPREVNEGINFUNKNNOWTIME+%-*/SINDUPEXCPOPCOSLOGEXPLTLEGTGEEQIFMINMAXLIMITFLOORCEILUNENDLTIMENEISINFPREV_OTHERCOUNTATANSQRTSORTREVTRENDTRENDNANATAN2RAD2DEGDEG2RADPREDICTPREDICTSIGMAAVGABSADDNANMINNANMAXNANMEDIANPREDICTPERCDEPTHCOPYROLLINDEXSTEPWIDTHNEWDAYNEWWEEKNEWMONTHNEWYEARSMINSMAXSTDEVPERCENTPOW" -var _Op_index = [...]uint16{0, 6, 14, 17, 21, 27, 31, 34, 38, 41, 44, 47, 50, 53, 56, 59, 62, 65, 68, 71, 74, 76, 78, 80, 82, 84, 86, 89, 92, 97, 102, 106, 108, 111, 116, 118, 123, 133, 138, 142, 146, 150, 153, 158, 166, 171, 178, 185, 192, 204, 207, 210, 216, 222, 228, 234, 245, 250, 254, 258, 263, 272, 278, 285, 293, 300, 304, 308, 313, 320, 323} +var _Op_index = [...]uint16{0, 6, 14, 17, 21, 27, 31, 34, 38, 39, 40, 41, 42, 43, 46, 49, 52, 55, 58, 61, 64, 66, 68, 70, 72, 74, 76, 79, 82, 87, 92, 96, 98, 101, 106, 108, 113, 123, 128, 132, 136, 140, 143, 148, 156, 161, 168, 175, 182, 194, 197, 200, 206, 212, 218, 224, 235, 240, 244, 248, 253, 262, 268, 275, 283, 290, 294, 298, 303, 310, 313} func (i Op) String() string { if i >= Op(len(_Op_index)-1) { diff --git a/rrdformat/rpn.go b/rrdformat/rpn.go index a138263..386c4ca 100644 --- a/rrdformat/rpn.go +++ b/rrdformat/rpn.go @@ -1,78 +1,95 @@ -//go:generate stringer -type=Op -trimprefix=OP_ +//go:generate stringer -type=Op -trimprefix=OP_ -linecomment package rrdformat type Op uint8 const ( - OP_NUMBER Op = iota // rrdtool 1.1.x 2001-03-10 - OP_VARIABLE // rrdtool 1.1.x 2001-03-10 - OP_INF // rrdtool 1.1.x 2001-03-10 - OP_PREV // rrdtool 1.1.x 2001-03-10 - OP_NEGINF // rrdtool 1.1.x 2001-03-10 - OP_UNKN // rrdtool 1.1.x 2001-03-10 - OP_NOW // rrdtool 1.1.x 2001-03-10 - OP_TIME // rrdtool 1.1.x 2001-03-10 - OP_ADD // rrdtool 1.1.x 2001-03-10 - OP_MOD // rrdtool 1.1.x 2001-03-10 - OP_SUB // rrdtool 1.1.x 2001-03-10 - OP_MUL // rrdtool 1.1.x 2001-03-10 - OP_DIV // rrdtool 1.1.x 2001-03-10 - OP_SIN // rrdtool 1.1.x 2001-03-10 - OP_DUP // rrdtool 1.1.x 2001-03-10 - OP_EXC // rrdtool 1.1.x 2001-03-10 - OP_POP // rrdtool 1.1.x 2001-03-10 - OP_COS // rrdtool 1.1.x 2001-03-10 - OP_LOG // rrdtool 1.1.x 2001-03-10 - OP_EXP // rrdtool 1.1.x 2001-03-10 - OP_LT // rrdtool 1.1.x 2001-03-10 - OP_LE // rrdtool 1.1.x 2001-03-10 - OP_GT // rrdtool 1.1.x 2001-03-10 - OP_GE // rrdtool 1.1.x 2001-03-10 - OP_EQ // rrdtool 1.1.x 2001-03-10 - OP_IF // rrdtool 1.1.x 2001-03-10 - OP_MIN // rrdtool 1.1.x 2001-03-10 - OP_MAX // rrdtool 1.1.x 2001-03-10 - OP_LIMIT // rrdtool 1.1.x 2001-03-10 - OP_FLOOR // rrdtool 1.1.x 2001-03-10 - OP_CEIL // rrdtool 1.1.x 2001-03-10 - OP_UN // rrdtool 1.1.x 2001-03-10 - OP_END // rrdtool 1.1.x 2001-03-10 - OP_LTIME // rrdtool 1.1.x 2001-03-10 - OP_NE // rrdtool 1.1.x 2002-03-10 - OP_ISINF // rrdtool 1.1.x 2002-03-10 - OP_PREV_OTHER // rrdtool 1.1.x 2002-07-06 - OP_COUNT // rrdtool 1.1.x 2003-07-14 - OP_ATAN // rrdtool 1.1.x 2004-05-04 - OP_SQRT // rrdtool 1.1.x 2004-08-24 - OP_SORT // rrdtool 1.1.x 2004-08-24 - OP_REV // rrdtool 1.1.x 2004-08-24 - OP_TREND // rrdtool 1.1.x 2004-09-24 - OP_TRENDNAN // rrdtool 1.3.0 // Problematic: Wasn't inserted at end - OP_ATAN2 // rrdtool 1.2.10 // Problematic: Definition in [1.2.10,1.3.0) differs from current - OP_RAD2DEG // rrdtool 1.2.10 // Problematic: Definition in [1.2.10,1.3.0) differs from current - OP_DEG2RAD // rrdtool 1.2.10 // Problematic: Definition in [1.2.10,1.3.0) differs from current - OP_PREDICT // rrdtool 1.4.0 // Problematic: Wasn't inserted at end - OP_PREDICTSIGMA // rrdtool 1.4.0 // Problematic: Wasn't inserted at end - OP_AVG // rrdtool 1.2.14 // Problematic: Definition in [1.2.14,1.4.0) differs from current - OP_ABS // rrdtool 1.2.20 // Problematic: Definition in [1.2.20,1.4.0) differs from current - OP_ADDNAN // rrdtool 1.3.0 // Problematic: Definition in [1.3.0,1.4.0) differs from current - OP_MINNAN // rrdtool 1.5.0 // Problematic: Wasn't inserted at end - OP_MAXNAN // rrdtool 1.5.0 // Problematic: Wasn't inserted at end - OP_MEDIAN // rrdtool 1.5.0 // Problematic: Definition in [1.5.0-pre.2012.06.01,1.5.0-pre.2014.02.07) differs from current - OP_PREDICTPERC // rrdtool 1.5.0 - OP_DEPTH // rrdtool 1.5.0 - OP_COPY // rrdtool 1.5.0 - OP_ROLL // rrdtool 1.5.0 - OP_INDEX // rrdtool 1.5.0 - OP_STEPWIDTH // rrdtool 1.5.4 - OP_NEWDAY // rrdtool 1.5.4 - OP_NEWWEEK // rrdtool 1.5.4 - OP_NEWMONTH // rrdtool 1.5.4 - OP_NEWYEAR // rrdtool 1.5.4 - OP_SMIN // rrdtool 1.6.0 - OP_SMAX // rrdtool 1.6.0 - OP_STDEV // rrdtool 1.6.0 - OP_PERCENT // rrdtool 1.6.0 - OP_POW // rrdtool 1.6.0 + // rrdtool 1.1.x 2001-03-10 + OP_NUMBER Op = iota + OP_VARIABLE + OP_INF + OP_PREV + OP_NEGINF + OP_UNKN + OP_NOW + OP_TIME + OP_ADD // + + OP_MOD // % + OP_SUB // - + OP_MUL // * + OP_DIV // / + OP_SIN + OP_DUP + OP_EXC + OP_POP + OP_COS + OP_LOG + OP_EXP + OP_LT + OP_LE + OP_GT + OP_GE + OP_EQ + OP_IF + OP_MIN + OP_MAX + OP_LIMIT + OP_FLOOR + OP_CEIL + OP_UN + OP_END + OP_LTIME + // rrdtool 1.1.x 2002-03-10 + OP_NE + OP_ISINF + // rrdtool 1.1.x 2002-07-06 + OP_PREV_OTHER + // rrdtool 1.1.x 2003-07-14 + OP_COUNT + // rrdtool 1.1.x 2004-05-04 + OP_ATAN + // rrdtool 1.1.x 2004-08-24 + OP_SQRT + OP_SORT + OP_REV + // rrdtool 1.1.x 2004-09-24 + OP_TREND + // rrdtool 1.3.0 -- Problematic: Wasn't inserted at end + OP_TRENDNAN + // rrdtool 1.2.10 -- Problematic: Definition in [1.2.10,1.3.0) differs from current + OP_ATAN2 + OP_RAD2DEG + OP_DEG2RAD + // rrdtool 1.4.0 -- Problematic: Wasn't inserted at end + OP_PREDICT + OP_PREDICTSIGMA + // rrdtool 1.2.14 -- Problematic: Definition in [1.2.14,1.4.0) differs from current + OP_AVG + OP_ABS + // rrdtool 1.3.0 -- Problematic: Definition in [1.3.0,1.4.0) differs from current + OP_ADDNAN + // rrdtool 1.5.0 -- Problematic: Wasn't inserted at end + OP_MINNAN + OP_MAXNAN + // rrdtool 1.5.0 -- Problematic: Definition in [1.5.0-pre.2012.06.01,1.5.0-pre.2014.02.07) differs from current + OP_MEDIAN + // rrdtool 1.5.0 + OP_PREDICTPERC + OP_DEPTH + OP_COPY + OP_ROLL + OP_INDEX + // rrdtool 1.5.4 + OP_STEPWIDTH + OP_NEWDAY + OP_NEWWEEK + OP_NEWMONTH + OP_NEWYEAR + // rrdtool 1.6.0 + OP_SMIN + OP_SMAX + OP_STDEV + OP_PERCENT + OP_POW ) -- cgit v1.2.3-2-g168b