This class represents a register that is used in the context of one or more logical blocks. The register number is assigned on demand or is statically specified if passed in to the constructor.
Initializes the register's name and number, if assigned. If a register number is specified, the instance will be assumed to have a statically assigned register number. The name is meant to be used as a symbolic variable name, such as 'counter' or 'key'.
# File lib/rex/poly/register.rb, line 30 def initialize(name, regnum = nil) @name = name @regnum = regnum @static = (regnum) ? true : false end
Returns the register number that has currently been assigned. If no register number is assigned, an InvalidRegisterError exception is raised. This exception can be used to assign the LogicalRegister instance a register number on demand.
# File lib/rex/poly/register.rb, line 59 def regnum raise InvalidRegisterError.new(self), "Register has not been assigned" if (@regnum == nil) @regnum end
Sets the register number to the value specified. If the register number is declared static, a RuntimeError exception is raised.
# File lib/rex/poly/register.rb, line 47 def regnum=(val) raise RuntimeError, "Attempted to assign regnum to static register" if (static?) @regnum = val end
Generated with the Darkfish Rdoc Generator 2.