Exemplo n.º 1
0
    def __init__(self, prop=None, offset=None):
        """ Constructor """

        self.fields = []

        if not self.format:
            try:
                if prop.arch == ARCH_32:
                    self.format = self.format_32
                elif prop.arch == ARCH_64:
                    self.format = self.format_64
                else:
                    self.format = []
            except AttributeError:
                self.format = []

        if not self.descriptions:
            try:
                if prop.arch == ARCH_32:
                    self.descriptions = self.descriptions_32
                elif prop.arch == ARCH_64:
                    self.descriptions = self.descriptions_64
                else:
                    self.descriptions = []
            except AttributeError:
                self.descriptions = []

        if not self.cf_descriptions:
            try:
                if prop.arch == ARCH_32:
                    self.cf_descriptions = self.cf_descriptions_32
                elif prop.arch == ARCH_64:
                    self.cf_descriptions = self.cf_descriptions_64
            except AttributeError:
                pass

        if not self.cf_format:
            try:
                if prop.arch == ARCH_32:
                    self.cf_format = self.cf_format_32
                elif prop.arch == ARCH_64:
                    self.cf_format = self.cf_format_64
            except AttributeError:
                pass

        if not self.hr_values:
            try:
                if prop.arch == ARCH_32:
                    self.hr_values = self.hr_values_32
                elif prop.arch == ARCH_64:
                    self.hr_values = self.hr_values_64
                else:
                    self.hr_values = {}
            except AttributeError:
                self.hr_values = {}

        Chunk.__init__(self, prop, True, offset,
                       calcsize(''.join(self.format)))
Exemplo n.º 2
0
    def __init__(self, prop=None, offset=None):
        """ Constructor """

        self.fields = []

        if not self.format:
            try:
                if prop.arch == ARCH_32:
                    self.format = self.format_32
                elif prop.arch == ARCH_64:
                    self.format = self.format_64
                else:
                    self.format = []
            except AttributeError:
                self.format = []

        if not self.descriptions:
            try:
                if prop.arch == ARCH_32:
                    self.descriptions = self.descriptions_32
                elif prop.arch == ARCH_64:
                    self.descriptions = self.descriptions_64
                else:
                    self.descriptions = []
            except AttributeError:
                self.descriptions = []

        if not self.cf_descriptions:
            try:
                if prop.arch == ARCH_32:
                    self.cf_descriptions = self.cf_descriptions_32
                elif prop.arch == ARCH_64:
                    self.cf_descriptions = self.cf_descriptions_64
            except AttributeError:
                pass

        if not self.cf_format:
            try:
                if prop.arch == ARCH_32:
                    self.cf_format = self.cf_format_32
                elif prop.arch == ARCH_64:
                    self.cf_format = self.cf_format_64
            except AttributeError:
                pass

        if not self.hr_values:
            try:
                if prop.arch == ARCH_32:
                    self.hr_values = self.hr_values_32
                elif prop.arch == ARCH_64:
                    self.hr_values = self.hr_values_64
                else:
                    self.hr_values = {}
            except AttributeError:
                self.hr_values = {}

        Chunk.__init__(self, prop, True, offset,
                       calcsize(''.join(self.format)))
Exemplo n.º 3
0
    def __init__(self, filename, access='r', load=True, backup=False):
        """ Constructor """

        self.access = access

        if self.access == 'w':
            mode = ACCESS_WRITE
        elif self.access == 'r':
            mode = ACCESS_READ
        else:
            mode = None

        size = getsize(filename)

        self.prop = Property(mode, backup, filename, size_src=size)

        self.header = None
        self.sections = []
        self.programs = []

        Chunk.__init__(self, prop=self.prop, load=load, offset=0, size=size)
Exemplo n.º 4
0
    def __init__(self, filename, access='r', load=True, backup=False):
        """ Constructor """

        self.access = access

        if self.access == 'w':
            mode = ACCESS_WRITE
        elif self.access == 'r':
            mode = ACCESS_READ
        else:
            mode = None

        size = getsize(filename)

        self.prop = Property(mode, backup, filename, size_src=size)

        self.header = None
        self.sections = []
        self.programs = []

        Chunk.__init__(self, prop=self.prop, load=load, offset=0, size=size)
Exemplo n.º 5
0
    def __init__(self, header, offset, size):
        """ Constructor """

        self.header = header

        Chunk.__init__(self, self.header.prop, True, offset, size, header)
Exemplo n.º 6
0
    def __init__(self, header, offset, size):
        """ Constructor """

        self.header = header

        Chunk.__init__(self, self.header.prop, True, offset, size, header)