add_op(OP_NOW,NOW)
add_op(OP_LTIME,LTIME)
add_op(OP_TIME,TIME)
+ add_op(OP_ATAN,ATAN)
#undef add_op
}
* occur too often. */
for (i = 0; rpnp[i].op != OP_END; i++) {
if (rpnp[i].op == OP_TIME || rpnp[i].op == OP_LTIME ||
- rpnp[i].op == OP_PREV)
+ rpnp[i].op == OP_PREV || rpnp[i].op == OP_COUNT)
{
rrd_set_error(
- "operators time, ltime and prev not supported with DS COMPUTE");
+ "operators time, ltime, prev and count not supported with DS COMPUTE");
free(rpnp);
return;
}
match_op(OP_DUP,DUP)
match_op(OP_EXC,EXC)
match_op(OP_POP,POP)
+ match_op(OP_LTIME,LTIME)
match_op(OP_LT,LT)
match_op(OP_LE,LE)
match_op(OP_GT,GT)
match_op(OP_UN,UN)
match_op(OP_NEGINF,NEGINF)
match_op(OP_NE,NE)
+ match_op(OP_COUNT,COUNT)
match_op_param(OP_PREV_OTHER,PREV)
match_op(OP_PREV,PREV)
match_op(OP_INF,INF)
match_op(OP_ISINF,ISINF)
match_op(OP_NOW,NOW)
- match_op(OP_LTIME,LTIME)
match_op(OP_TIME,TIME)
+ match_op(OP_ATAN,ATAN)
#undef match_op
}
}
break;
+ case OP_COUNT:
+ rpnstack -> s[++stptr] = (output_idx+1); /* Note: Counter starts at 1 */
+ break;
case OP_PREV:
- if ((output_idx-1) <= 0) {
+ if ((output_idx) <= 0) {
rpnstack -> s[++stptr] = DNAN;
} else {
rpnstack -> s[++stptr] = output[output_idx-1];
}
break;
case OP_PREV_OTHER:
- if ((output_idx-1) <= 0) {
+ if ((output_idx) <= 0) {
rpnstack -> s[++stptr] = DNAN;
} else {
rpnstack -> s[++stptr] = rpnp[rpnp[rpi].ptr].data[output_idx-1];
stackunderflow(0);
rpnstack -> s[stptr] = sin(rpnstack -> s[stptr]);
break;
+ case OP_ATAN:
+ stackunderflow(0);
+ rpnstack -> s[stptr] = atan(rpnstack -> s[stptr]);
+ break;
case OP_COS:
stackunderflow(0);
rpnstack -> s[stptr] = cos(rpnstack -> s[stptr]);