# Path: voidwalker/framework/platform/cpu.py
# class Register(object):
#     class StaticRegister(type(register), object):
# class Cpu(object):
# class CpuFactory(object):
# class CpuRepository(object):
#     def __init__(self, name):
#     def name(self):
#     def size(self):
#     def value(self):
#     def str(self):
# def create_static_register(register):
#         def __init__(self, name):
#         def size(self):
#         def value(self):
#     def __init__(self, cpu_factory, registers):
#     def architecture(cls):
#     def register(self, name):
#     def registers(self):
#     def stack_pointer(self):
#     def program_counter(self):
#     def create_cpu(self, architecture):
#     def create_register(self, cpu, register):
#     def __init__(self, cpu_factory):
#     def get_cpu(self, architecture):
# def register_cpu(cls):
# 
# Path: voidwalker/framework/platform/cpu.py
# class Cpu(object):
#     __metaclass__ = abc.ABCMeta
# 
#     def __init__(self, cpu_factory, registers):
#         self._registers = OrderedDict()
#         for group, register_list in registers.iteritems():
#             registers = OrderedDict([(x.name(),
#                                       cpu_factory.create_register(self, x))
#                                      for x in register_list])
# 
#             self._registers[group] = registers
# 
#     @classmethod
#     @abc.abstractmethod
#     def architecture(cls):
#         raise NotImplementedError
# 
#     def register(self, name):
#         for register_dict in self._registers.itervalues():
#             if name in register_dict:
#                 return register_dict[name]
# 
#         return None
# 
#     def registers(self):
#         return self._registers.iteritems()
# 
#     @abc.abstractmethod
#     def stack_pointer(self):
#         raise NotImplementedError
# 
#     @abc.abstractmethod
#     def program_counter(self):
#         raise NotImplementedError
# 
# Path: voidwalker/framework/platform/cpu.py
# class Register(object):
#     _register_fmt = {16: '0x%032lX',
#                      10: '0x%020lX',
#                      8: '0x%016lX',
#                      4: '0x%08lX',
#                      2: '0x%04lX',
#                      1: '0x%02lX'}
# 
#     def __init__(self, name):
#         self._name = name
# 
#     def name(self):
#         return self._name
# 
#     def size(self):
#         raise NotImplementedError
# 
#     def value(self):
#         raise NotImplementedError
# 
#     def str(self):
#         if self.value() is not None:
#             return self._register_fmt[self.size()] % self.value()
#         chars_per_byte = 2
#         return ''.join(['-' * (self.size() * chars_per_byte)])
# 
# Path: voidwalker/framework/platform/cpu.py
# def register_cpu(cls):
#     _cpu_map[cls.architecture()] = cls
#     return cls


from ...framework.platform import Architecture
from ...framework.platform import Cpu
from ...framework.platform import Register
from ...framework.platform import register_cpu
# (void)walker CPU architecture support
# Copyright (C) 2013 David Holm <dholmster@gmail.com>

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.



@register_cpu
class GenericCpu(Cpu):
    def __init__(self, cpu_factory, registers):
        for group, register_list in registers.iteritems():
            registers[group] = [Register(x) for x in register_list]
        super(GenericCpu, self).__init__(cpu_factory, registers)

    @classmethod
    def architecture(cls):

# Path: voidwalker/framework/platform/cpu.py
# class Register(object):
#     class StaticRegister(type(register), object):
# class Cpu(object):
# class CpuFactory(object):
# class CpuRepository(object):
#     def __init__(self, name):
#     def name(self):
#     def size(self):
#     def value(self):
#     def str(self):
# def create_static_register(register):
#         def __init__(self, name):
#         def size(self):
#         def value(self):
#     def __init__(self, cpu_factory, registers):
#     def architecture(cls):
#     def register(self, name):
#     def registers(self):
#     def stack_pointer(self):
#     def program_counter(self):
#     def create_cpu(self, architecture):
#     def create_register(self, cpu, register):
#     def __init__(self, cpu_factory):
#     def get_cpu(self, architecture):
# def register_cpu(cls):
# 
# Path: voidwalker/framework/platform/cpu.py
# class Cpu(object):
#     __metaclass__ = abc.ABCMeta
# 
#     def __init__(self, cpu_factory, registers):
#         self._registers = OrderedDict()
#         for group, register_list in registers.iteritems():
#             registers = OrderedDict([(x.name(),
#                                       cpu_factory.create_register(self, x))
#                                      for x in register_list])
# 
#             self._registers[group] = registers
# 
#     @classmethod
#     @abc.abstractmethod
#     def architecture(cls):
#         raise NotImplementedError
# 
#     def register(self, name):
#         for register_dict in self._registers.itervalues():
#             if name in register_dict:
#                 return register_dict[name]
# 
#         return None
# 
#     def registers(self):
#         return self._registers.iteritems()
# 
#     @abc.abstractmethod
#     def stack_pointer(self):
#         raise NotImplementedError
# 
#     @abc.abstractmethod
#     def program_counter(self):
#         raise NotImplementedError
# 
# Path: voidwalker/framework/platform/cpu.py
# class Register(object):
#     _register_fmt = {16: '0x%032lX',
#                      10: '0x%020lX',
#                      8: '0x%016lX',
#                      4: '0x%08lX',
#                      2: '0x%04lX',
#                      1: '0x%02lX'}
# 
#     def __init__(self, name):
#         self._name = name
# 
#     def name(self):
#         return self._name
# 
#     def size(self):
#         raise NotImplementedError
# 
#     def value(self):
#         raise NotImplementedError
# 
#     def str(self):
#         if self.value() is not None:
#             return self._register_fmt[self.size()] % self.value()
#         chars_per_byte = 2
#         return ''.join(['-' * (self.size() * chars_per_byte)])
# 
# Path: voidwalker/framework/platform/cpu.py
# def register_cpu(cls):
#     _cpu_map[cls.architecture()] = cls
#     return cls


# Path: voidwalker/application/cpus/generic.py
from ...framework.platform import Architecture
from ...framework.platform import Cpu
from ...framework.platform import Register
from ...framework.platform import register_cpu

# (void)walker CPU architecture support
# Copyright (C) 2013 David Holm <dholmster@gmail.com>

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.



@register_cpu
class GenericCpu(Cpu):
    def __init__(self, cpu_factory, registers):
        for group, register_list in registers.iteritems():
            registers[group] = [Register(x) for x in register_list]
        super(GenericCpu, self).__init__(cpu_factory, registers)

    @classmethod
    def architecture(cls):

        return Architecture.Generic