about summary refs log tree commit diff stats
path: root/miasm2/core
diff options
context:
space:
mode:
Diffstat (limited to 'miasm2/core')
-rw-r--r--miasm2/core/asmblock.py3
-rw-r--r--miasm2/core/cpu.py2
-rw-r--r--miasm2/core/ctypesmngr.py24
-rw-r--r--miasm2/core/objc.py3
-rw-r--r--miasm2/core/parse_asm.py3
-rw-r--r--miasm2/core/types.py24
6 files changed, 53 insertions, 6 deletions
diff --git a/miasm2/core/asmblock.py b/miasm2/core/asmblock.py
index c00b4c5c..2f336617 100644
--- a/miasm2/core/asmblock.py
+++ b/miasm2/core/asmblock.py
@@ -4,8 +4,7 @@ import logging
 import warnings
 from collections import namedtuple
 
-from miasm2.expression.expression import ExprId, ExprInt, ExprLoc, \
-    get_expr_locs
+from miasm2.expression.expression import ExprId, ExprInt, get_expr_locs
 from miasm2.expression.expression import LocKey
 from miasm2.expression.simplifications import expr_simp
 from miasm2.expression.modint import moduint, modint
diff --git a/miasm2/core/cpu.py b/miasm2/core/cpu.py
index 686e12ba..bd30e0f8 100644
--- a/miasm2/core/cpu.py
+++ b/miasm2/core/cpu.py
@@ -135,7 +135,6 @@ class reg_info_dct(object):
 
 def gen_reg(reg_name, sz=32):
     """Gen reg expr and parser"""
-    reg_name_lower = reg_name.lower()
     reg = m2_expr.ExprId(reg_name, sz)
     reginfo = reg_info([reg_name], [reg])
     return reg, reginfo
@@ -149,7 +148,6 @@ def gen_reg_bs(reg_name, reg_info, base_cls):
 
         bs_reg_name = bs(l=0, cls=(bs_reg_name,))
     """
-    reg_name_lower = reg_name.lower()
 
     bs_name = "bs_%s" % reg_name
     cls = type(bs_name, base_cls, {'reg': reg_info})
diff --git a/miasm2/core/ctypesmngr.py b/miasm2/core/ctypesmngr.py
index e99e3829..ef14451f 100644
--- a/miasm2/core/ctypesmngr.py
+++ b/miasm2/core/ctypesmngr.py
@@ -69,6 +69,9 @@ class CTypeId(CTypeBase):
         return (self.eq_base(other) and
                 self.names == other.names)
 
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
     def __str__(self):
         return "<Id:%s>" % ', '.join(self.names)
 
@@ -92,6 +95,9 @@ class CTypeArray(CTypeBase):
                 self.target == other.target and
                 self.size == other.size)
 
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
     def __str__(self):
         return "<Array[%s]:%s>" % (self.size, str(self.target))
 
@@ -113,6 +119,9 @@ class CTypePtr(CTypeBase):
         return (self.eq_base(other) and
                 self.target == other.target)
 
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
     def __str__(self):
         return "<Ptr:%s>" % str(self.target)
 
@@ -139,6 +148,9 @@ class CTypeStruct(CTypeBase):
                 self.name == other.name and
                 self.fields == other.fields)
 
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
     def __str__(self):
         out = []
         out.append("<Struct:%s>" % self.name)
@@ -191,6 +203,9 @@ class CTypeEnum(CTypeBase):
         return (self.eq_base(other) and
                 self.name == other.name)
 
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
     def __str__(self):
         return "<Enum:%s>" % self.name
 
@@ -224,6 +239,9 @@ class CTypeFunc(CTypeBase):
                 self.type_ret == other.type_ret and
                 self.args == other.args)
 
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
     def __str__(self):
         return "<Func:%s (%s) %s(%s)>" % (self.type_ret,
                                           self.abi,
@@ -240,6 +258,9 @@ class CTypeEllipsis(CTypeBase):
     def __eq__(self, other):
         return self.eq_base(other)
 
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
     def __str__(self):
         return "<Ellipsis>"
 
@@ -258,6 +279,9 @@ class CTypeSizeof(CTypeBase):
         return (self.eq_base(other) and
                 self.target == other.target)
 
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
     def __str__(self):
         return "<Sizeof(%s)>" % self.target
 
diff --git a/miasm2/core/objc.py b/miasm2/core/objc.py
index 80f1e341..9649514d 100644
--- a/miasm2/core/objc.py
+++ b/miasm2/core/objc.py
@@ -464,6 +464,9 @@ class CGenInt(CGen):
         return (super(CGenInt, self).__eq__(other) and
                 self._integer == other.integer)
 
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
     def to_c(self):
         """Generate corresponding C"""
 
diff --git a/miasm2/core/parse_asm.py b/miasm2/core/parse_asm.py
index 7efa17d0..e60c8ca7 100644
--- a/miasm2/core/parse_asm.py
+++ b/miasm2/core/parse_asm.py
@@ -1,8 +1,7 @@
 #-*- coding:utf-8 -*-
 import re
 
-from miasm2.expression.expression import ExprId, ExprInt, ExprOp, ExprLoc, \
-    LocKey
+from miasm2.expression.expression import ExprId, ExprInt, ExprOp, LocKey
 import miasm2.core.asmblock as asmblock
 from miasm2.core.cpu import instruction, base_expr
 from miasm2.core.asm_ast import AstInt, AstId, AstOp
diff --git a/miasm2/core/types.py b/miasm2/core/types.py
index b0aca07e..e6ba1ccf 100644
--- a/miasm2/core/types.py
+++ b/miasm2/core/types.py
@@ -369,6 +369,9 @@ class RawStruct(Type):
     def __eq__(self, other):
         return self.__class__ == other.__class__ and self._fmt == other._fmt
 
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
     def __hash__(self):
         return hash((self.__class__, self._fmt))
 
@@ -503,6 +506,9 @@ class Ptr(Num):
                 self._type_args == other._type_args and \
                 self._type_kwargs == other._type_kwargs
 
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
     def __hash__(self):
         return hash((super(Ptr, self).__hash__(), self.dst_type,
             self._type_args))
@@ -673,6 +679,9 @@ class Struct(Type):
                 self.fields == other.fields and \
                 self.name == other.name
 
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
     def __hash__(self):
         # Only hash name, not fields, because if a field is a Ptr to this
         # Struct type, an infinite loop occurs
@@ -862,6 +871,9 @@ class Array(Type):
                 self.field_type == other.field_type and \
                 self.array_len == other.array_len
 
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
     def __hash__(self):
         return hash((self.__class__, self.field_type, self.array_len))
 
@@ -926,6 +938,9 @@ class Bits(Type):
                 self._num == other._num and self._bits == other._bits and \
                 self._bit_offset == other._bit_offset
 
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
     def __hash__(self):
         return hash((self.__class__, self._num, self._bits, self._bit_offset))
 
@@ -983,6 +998,9 @@ class BitField(Union):
         return self.__class__ == other.__class__ and \
                 self._num == other._num and super(BitField, self).__eq__(other)
 
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
     def __hash__(self):
         return hash((super(BitField, self).__hash__(), self._num))
 
@@ -1095,6 +1113,9 @@ class Str(Type):
     def __eq__(self, other):
         return self.__class__ == other.__class__ and self._enc == other._enc
 
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
     def __hash__(self):
         return hash((self.__class__, self._enc))
 
@@ -1111,6 +1132,9 @@ class Void(Type):
     def __eq__(self, other):
         return self.__class__ == other.__class__
 
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
     def __hash__(self):
         return hash(self.__class__)