# HG changeset patch # User Thinker K.F. Li # Date 1308548087 -28800 # Node ID 3936d223989a888f4a86dc277d3095aab7cef0f2 # Parent cd4e3584ed7f58f9c78528183180cb1ff069f45b Introduce null_relocatable for any relocatable without real instance - Some dex type does not own a real instance, it actually a generator of child type. - null_relocatable is used to classify types without real instance. diff -r cd4e3584ed7f -r 3936d223989a paraspace/dexfile.py --- a/paraspace/dexfile.py Mon Jun 20 13:32:15 2011 +0800 +++ b/paraspace/dexfile.py Mon Jun 20 13:34:47 2011 +0800 @@ -393,11 +393,38 @@ pass +class relocatable(_dex_type): + data_size = None + + @staticmethod + def parse(parent, data, off): + pass + + @staticmethod + def sizeof(v): + return v.data_size + + def to_str(self): + pass + + def compute_size(self): + pass + + def children(self): + raise NotImplementedError, \ + '%s: does not implement children' % (self.__class__.__name__) + pass + + +class null_relocatable(relocatable): + pass + + ## \brief Implicit reference to a target. # # It is a placeholder for storing relationship defined by an association. # -class ref(_dex_type): +class ref(null_relocatable): target_path = None target = None @@ -453,29 +480,6 @@ pass -class relocatable(_dex_type): - data_size = None - - @staticmethod - def parse(parent, data, off): - pass - - @staticmethod - def sizeof(v): - return v.data_size - - def to_str(self): - pass - - def compute_size(self): - pass - - def children(self): - raise NotImplementedError, \ - '%s: does not implement children' % (self.__class__.__name__) - pass - - class array(relocatable): count_name = None child_type = None @@ -716,7 +720,7 @@ pass -class depend(relocatable): +class depend(null_relocatable): depend_on = None child_type = None