summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 12ba117)
raw | patch | inline | side by side (parent: 12ba117)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Wed, 14 Feb 2007 18:54:29 +0000 (18:54 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Wed, 14 Feb 2007 18:54:29 +0000 (18:54 +0000) |
git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2/program@1008 a5681a0c-68f1-0310-ab6d-d61299d08faa
doc/rrdgraph_rpn.pod | patch | blob | history | |
src/rrd_rpncalc.c | patch | blob | history | |
src/rrd_rpncalc.h | patch | blob | history |
diff --git a/doc/rrdgraph_rpn.pod b/doc/rrdgraph_rpn.pod
index 6e31ea6d09916eda496096b02f23acb5ad7d6002..b2a84dd9daa4a1c55d3a354e9de577918e94cc14 100644 (file)
--- a/doc/rrdgraph_rpn.pod
+++ b/doc/rrdgraph_rpn.pod
Convert angle in degrees to radians, or radians to degrees.
+B<ABS>
+
+Take the absolute value.
+
=item Set Operations
B<SORT, REV>
diff --git a/src/rrd_rpncalc.c b/src/rrd_rpncalc.c
index a5ab61f9a2da7c526b14ebd770e0c541a0f19c16..972f486b023ed054a6bd2915543c71eb877015f9 100644 (file)
--- a/src/rrd_rpncalc.c
+++ b/src/rrd_rpncalc.c
add_op(OP_RAD2DEG,RAD2DEG)
add_op(OP_DEG2RAD,DEG2RAD)
add_op(OP_AVG,AVG)
+ add_op(OP_ABS,ABS)
#undef add_op
}
(*str)[offset] = '\0';
@@ -340,6 +341,7 @@ rpn_parse(void *key_hash,const char *const expr_const,long (*lookup)(void *,char
match_op(OP_RAD2DEG,RAD2DEG)
match_op(OP_DEG2RAD,DEG2RAD)
match_op(OP_AVG,AVG)
+ match_op(OP_ABS,ABS)
#undef match_op
}
}
break;
+ case OP_ABS:
+ stackunderflow(0);
+ rpnstack -> s[stptr] = fabs(rpnstack -> s[stptr]);
+ break;
case OP_END:
break;
}
diff --git a/src/rrd_rpncalc.h b/src/rrd_rpncalc.h
index beccfd5e5dc841e73f7385b6a97844913b5b2574..357580825df30b7dafe07ef407aa37e827c1d12b 100644 (file)
--- a/src/rrd_rpncalc.h
+++ b/src/rrd_rpncalc.h
OP_UN,OP_END,OP_LTIME,OP_NE,OP_ISINF,OP_PREV_OTHER,OP_COUNT,
OP_ATAN,OP_SQRT,OP_SORT,OP_REV,OP_TREND,
OP_ATAN2,OP_RAD2DEG,OP_DEG2RAD,
- OP_AVG};
+ OP_AVG,OP_ABS};
typedef struct rpnp_t {
enum op_en op;