(self, reg)
return None
Returns the Unicorn Emulator enum code for the named register.

        Also supports general registers like 'sp' and 'pc'.
Returns the Unicorn Emulator enum code for the named register.
Returns the Unicorn Emulator enum code for the named register .
def get_reg_enum(self, reg):
        """
        Returns the Unicorn Emulator enum code for the named register.

        Also supports general registers like 'sp' and 'pc'.
        """
        if not self.regs:
            return None

        # If we're looking for an exact register ('eax', 'ebp', 'r0') then
        # we can look those up easily.
        #
        #  'eax' ==> enum
        #
        if reg in self.regs.all:
            e = self.const_regs.get(reg.upper(), None)
            if e is not None:
                return e

        # If we're looking for an abstract register which *is* accounted for,
        # we can also do an indirect lookup.
        #
        #   'pc' ==> 'eip' ==> enum
        #
        if hasattr(self.regs, reg):
            return self.get_reg_enum(getattr(self.regs, reg))

        # If we're looking for an abstract register which does not exist on
        # the RegisterSet objects, we need to do an indirect lookup.
        #
        #   'sp' ==> 'stack' ==> 'esp' ==> enum
        #
        elif reg == 'sp':
            return self.get_reg_enum(self.regs.stack)

        return None
def get_reg_enum ( self , reg ) : if not self . regs : return None # If we're looking for an exact register ('eax', 'ebp', 'r0') then # we can look those up easily. # #  'eax' ==> enum # if reg in self . regs . all : e = self . const_regs . get ( reg . upper ( ) , None ) if e is not None : return e # If we're looking for an abstract register which *is* accounted for, # we can also do an indirect lookup. # #   'pc' ==> 'eip' ==> enum # if hasattr ( self . regs , reg ) : return self . get_reg_enum ( getattr ( self . regs , reg ) ) # If we're looking for an abstract register which does not exist on # the RegisterSet objects, we need to do an indirect lookup. # #   'sp' ==> 'stack' ==> 'esp' ==> enum # elif reg == 'sp' : return self . get_reg_enum ( self . regs . stack ) return None