# Path: x86tokenizer.py
# class tokenizeError(Exception):pass
# REGISTER,OPCODE,COMMA,OPERAND,LBRACKET,RBRACKET,NUMBER,SYMBOL,STRING = range(1,10)
# def tokenizeString(s,reToProcess):
# def tokenizeInstDef(s):
# def tokenizeInst(s):


import logging
import struct
from pickle import decode_long, encode_long
from x86tokenizer import (tokenizeInstDef,tokenizeInst,
                          REGISTER,OPCODE,COMMA,OPERAND,
                          LBRACKET, RBRACKET,NUMBER,SYMBOL)
            disp = self.ModRM.GetDisplacementSize()
            if disp == 1:
                retVal += ''.join(longToString(self.Displacement,1))
            elif disp == 4:
                logging.error("DISPLACEMENT %s" % self.Displacement)
                retVal += ''.join(longToString(self.Displacement,4))
        if self.Instruction.HasDisplacement:
            retVal += ''.join(longToString(self.Displacement,self.Instruction.DisplacementSize))
        if self.Instruction.HasImmediate:
            retVal += ''.join(longToString(self.Immediate,self.Instruction.ImmediateSize))

        if len(retVal) != self.GetInstructionSize():
            raise x86instError("Invalid Instruction Size '%s' '%s'" % (self.Instruction.InstructionString, \
                                                                       retVal))
        return retVal
    
            
    def OpText(self):
        size = 0
        retVal = ''
        
        retVal += "  %08X: " % self.Address

        ds = self.OpDataAsString()
        for c in ds:
            retVal += "%02X " % ord(c)
        retVal += "   " * (8-len(ds))

        opcodeStr, operandStr = "",""        
        for typ,val in self.Instruction.InstructionDef:

# Path: x86tokenizer.py
# class tokenizeError(Exception):pass
# REGISTER,OPCODE,COMMA,OPERAND,LBRACKET,RBRACKET,NUMBER,SYMBOL,STRING = range(1,10)
# def tokenizeString(s,reToProcess):
# def tokenizeInstDef(s):
# def tokenizeInst(s):


# Path: x86inst.py
import logging
import struct
from pickle import decode_long, encode_long
from x86tokenizer import (tokenizeInstDef,tokenizeInst,
                          REGISTER,OPCODE,COMMA,OPERAND,
                          LBRACKET, RBRACKET,NUMBER,SYMBOL)

            disp = self.ModRM.GetDisplacementSize()
            if disp == 1:
                retVal += ''.join(longToString(self.Displacement,1))
            elif disp == 4:
                logging.error("DISPLACEMENT %s" % self.Displacement)
                retVal += ''.join(longToString(self.Displacement,4))
        if self.Instruction.HasDisplacement:
            retVal += ''.join(longToString(self.Displacement,self.Instruction.DisplacementSize))
        if self.Instruction.HasImmediate:
            retVal += ''.join(longToString(self.Immediate,self.Instruction.ImmediateSize))

        if len(retVal) != self.GetInstructionSize():
            raise x86instError("Invalid Instruction Size '%s' '%s'" % (self.Instruction.InstructionString, \
                                                                       retVal))
        return retVal
    
            
    def OpText(self):
        size = 0
        retVal = ''
        
        retVal += "  %08X: " % self.Address

        ds = self.OpDataAsString()
        for c in ds:
            retVal += "%02X " % ord(c)
        retVal += "   " * (8-len(ds))

        opcodeStr, operandStr = "",""        
        for typ,val in self.Instruction.InstructionDef:

            if typ == OPCODE: