~ubuntu-branches/ubuntu/trusty/torrus/trusty-proposed

« back to all changes in this revision

Viewing changes to perllib/Torrus/RPN.pm

  • Committer: Bazaar Package Importer
  • Author(s): Marc Haber, Upstream changes relevant for Debian, Jurij Smakov, Marc Haber
  • Date: 2006-07-24 13:08:45 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20060724130845-zmew22g8p6g2vmz3
Tags: 1.0.4-1
[ Upstream changes relevant for Debian ]
* New upstream release.

[ Jurij Smakov ]
* Expand the copyright file to include the information about all
  authors and copyright holders.
* Use invoke-rc.d instead of invoking the init script directly
  in maintainer scripts.

[ Marc Haber ]
* Standards-Version: 3.7.2 (no changes needed)
* Move debhelper and dpatch to Build-Depends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
#    along with this program; if not, write to the Free Software
17
17
#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
18
18
 
19
 
# $Id: RPN.pm,v 1.3 2005/03/08 13:51:50 ssinyagin Exp $
 
19
# $Id: RPN.pm,v 1.8 2006/01/06 10:41:09 ssinyagin Exp $
20
20
# Stanislav Sinyagin <ssinyagin@yahoo.com>
21
21
 
22
22
# a simple little RPN calculator -- implements the same operations
47
47
    'EXP' => [ 1, sub{ $_[0]->exponent() } ],
48
48
    'FLOOR' => [ 1, sub{ $_[0]->bfloor(); } ],
49
49
    'CEIL' => [ 1, sub{ $_[0]->bceil(); } ],
50
 
    'LT' => [ 2, sub{ $_[0] <  $_[1] ? 1:0; } ],
51
 
    'LE' => [ 2, sub{ $_[0] <= $_[1] ? 1:0; } ],
52
 
    'GT' => [ 2, sub{ $_[0] >  $_[1] ? 1:0; } ],
53
 
    'GE' => [ 2, sub{ $_[0] >= $_[1] ? 1:0; } ],
54
 
    'EQ' => [ 2, sub{ $_[0] == $_[1] ? 1:0; } ],
 
50
    'LT' => [ 2, sub{ ($_[0] <  $_[1]) ? 1:0; } ],
 
51
    'LE' => [ 2, sub{ ($_[0] <= $_[1]) ? 1:0; } ],
 
52
    'GT' => [ 2, sub{ ($_[0] >  $_[1]) ? 1:0; } ],
 
53
    'GE' => [ 2, sub{ ($_[0] >= $_[1]) ? 1:0; } ],
 
54
    'EQ' => [ 2, sub{ ($_[0] == $_[1]) ? 1:0; } ],
55
55
    'IF' => [ 3, sub{ $_[0] ? $_[1] : $_[2]; } ],
56
 
    'MIN' => [ 2, sub{ $_[0] <  $_[1] ? $_[0] : $_[1]; } ],
57
 
    'MAX' => [ 2, sub{ $_[0] >  $_[1] ? $_[0] : $_[1]; } ],
 
56
    'MIN' => [ 2, sub{ ($_[0] <  $_[1]) ? $_[0] : $_[1]; } ],
 
57
    'MAX' => [ 2, sub{ ($_[0] >  $_[1]) ? $_[0] : $_[1]; } ],
58
58
    'UN'   => [ 1, sub{ defined($_[0]) ? $_[0]->is_nan() : 1; }, 1 ],
59
59
    'UNKN' => [ 0, sub{ undef; } ],
60
60
    # Operators not defined in RRDtool graph
61
 
    'NE'  => [ 2, sub{ $_[0] != $_[1] ? 1:0; } ],
62
 
    'AND' => [ 2, sub{ $_[0] and $_[1] ? 1:0; } ],
63
 
    'OR'  => [ 2, sub{ $_[0] or $_[1] ? 1:0; } ],
64
 
    'NOT' => [ 1, sub{ not $_[0] ? 1:0; } ],
 
61
    'NE'  => [ 2, sub{ ($_[0] != $_[1]) ? 1:0; } ],
 
62
    'AND' => [ 2, sub{ ($_[0] and $_[1]) ? 1:0; } ],
 
63
    'OR'  => [ 2, sub{ ($_[0] or $_[1]) ? 1:0; } ],
 
64
    'NOT' => [ 1, sub{ (not $_[0]) ? 1:0; } ],
65
65
    'ABS' => [ 1, sub{ abs($_[0]); } ],
66
66
    'NOW' => [ 0, sub{ time(); } ],
67
 
    'DUP' => [ 1, sub{ ($_[0], $_[0]);} ],
68
 
    'EXC' => [ 2, sub{ ($_[1], $_[0]); } ]
69
 
};
 
67
    'DUP' => [ 1, sub{ ($_[0], $_[0]);}, 1 ],
 
68
    'EXC' => [ 2, sub{ ($_[1], $_[0]); }, 1 ],
 
69
    'NUM' => [ 1, sub{ defined($_[0]) ? $_[0] : 0; }, 1 ],
 
70
    'INF' => [ 0, sub{ Math::BigFloat->binf(); } ],
 
71
    'NEGINF' => [ 0, sub{ Math::BigFloat->binf('-'); } ]
 
72
    };
70
73
 
71
74
 
72
75
sub new