# Path: pwnypack/shellcode/ops.py
# class SyscallInvoke(object):
#     def __init__(self, syscall_def, args):
#         self.syscall_def = syscall_def
#         self.args = args
# 
#     def __repr__(self):
#         return '%s(%s)' % (self.syscall_def.name, ', '.join(repr(a) for a in self.args))


import six
from pwnypack.shellcode.ops import SyscallInvoke
class PTR(object):
    @staticmethod
    def verify(value):
        if not isinstance(value, (type(None), six.integer_types, Register, Offset, Buffer, SyscallInvoke,
                                  six.string_types, six.binary_type, list)):
            raise ValueError('syscall argument not of expected type ptr')


class CHARP(object):
    @staticmethod
    def verify(value):
        if not isinstance(value, (type(None), six.string_types, six.binary_type, Register, Offset, Buffer)):
            raise ValueError('syscall argument not of expected type str/bytes')


CHARPP = Array(CHARP)


class SyscallDef(object):
    def __init__(self, name, *arg_types):
        self.name = name
        self.arg_types = arg_types

    def __call__(self, *args):
        if not len(args) == len(self.arg_types):
            raise ValueError('Incorrect number of syscall arguments')

        for arg_type, arg_value in zip(self.arg_types, args):
            arg_type.verify(arg_value)


# Path: pwnypack/shellcode/ops.py
# class SyscallInvoke(object):
#     def __init__(self, syscall_def, args):
#         self.syscall_def = syscall_def
#         self.args = args
# 
#     def __repr__(self):
#         return '%s(%s)' % (self.syscall_def.name, ', '.join(repr(a) for a in self.args))


# Path: pwnypack/shellcode/types.py
import six
from pwnypack.shellcode.ops import SyscallInvoke

class PTR(object):
    @staticmethod
    def verify(value):
        if not isinstance(value, (type(None), six.integer_types, Register, Offset, Buffer, SyscallInvoke,
                                  six.string_types, six.binary_type, list)):
            raise ValueError('syscall argument not of expected type ptr')


class CHARP(object):
    @staticmethod
    def verify(value):
        if not isinstance(value, (type(None), six.string_types, six.binary_type, Register, Offset, Buffer)):
            raise ValueError('syscall argument not of expected type str/bytes')


CHARPP = Array(CHARP)


class SyscallDef(object):
    def __init__(self, name, *arg_types):
        self.name = name
        self.arg_types = arg_types

    def __call__(self, *args):
        if not len(args) == len(self.arg_types):
            raise ValueError('Incorrect number of syscall arguments')

        for arg_type, arg_value in zip(self.arg_types, args):
            arg_type.verify(arg_value)


        return SyscallInvoke(self, args)