From: <buc...@us...> - 2011-04-04 11:26:08
|
Revision: 228 http://devmon.svn.sourceforge.net/devmon/?rev=228&view=rev Author: buchanmilne Date: 2011-04-04 11:26:02 +0000 (Mon, 04 Apr 2011) Log Message: ----------- Allow '*' as multiplication operator Modified Paths: -------------- trunk/docs/TEMPLATES trunk/modules/dm_templates.pm Modified: trunk/docs/TEMPLATES =================================================================== --- trunk/docs/TEMPLATES 2011-04-04 10:59:18 UTC (rev 227) +++ trunk/docs/TEMPLATES 2011-04-04 11:26:02 UTC (rev 228) @@ -431,7 +431,8 @@ operators: '+' (Addition) '-' (Subtraction) - ' x ' (Multiplication - note white space on each side) + '*' (Muliplication) + ' x ' (Multiplication - note white space on each side) (deprecated) '/' (Division) '^' (Exponentiation) '%' (Modulo or Remainder) @@ -440,7 +441,7 @@ ' . ' (string concatenation - note white space each side) '(' and ')' (Expression nesting) - This transform is not whitespace sensitive, except in the case of ' x ' and ' . ' , so both: + This transform is not whitespace sensitive, except in the case of ' x ' and ' . ' , so both: {sysUpTime} / 100 and {sysUpTime}/100 @@ -452,7 +453,8 @@ will work, while: {ifInOps}x8 will not. This is to avoid problems with oid names containing the character - 'x'. + 'x'. New templates should rather use the '*' operator to avoid problems, e.g.: + {ifInOps}*8 The mathematical expressions you can perform can be quite complex, such as: Modified: trunk/modules/dm_templates.pm =================================================================== --- trunk/modules/dm_templates.pm 2011-04-04 10:59:18 UTC (rev 227) +++ trunk/modules/dm_templates.pm 2011-04-04 11:26:02 UTC (rev 228) @@ -544,7 +544,7 @@ $func_type eq 'math' and do { $temp =~ s/:\s*\d+\s*$//; - $temp =~ s/\{\s*\S+?\s*\}|\s\.\s|\sx\s|\+|\/|-|\^|%|\||&|\d+(\.\d*)?|\(|\)\s*//g; + $temp =~ s/\{\s*\S+?\s*\}|\s\.\s|\sx\s|\*|\+|\/|-|\^|%|\||&|\d+(\.\d*)?|\(|\)\s*//g; do_log("MATH transform uses only math/numeric symbols and an " . "optional precision number at $trans_file, line $l_num", 0) and next LINE if $temp !~ /^\s*$/; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |