from awlsim.common.cython_support cimport *
from awlsim.core.offset cimport *
from awlsim.core.instructions.main cimport *
from awlsim.core.memory cimport *

cdef class AwlOperator(object):
	cdef public uint32_t operType
	cdef public int32_t width
	cdef public AwlInsn insn

	# The operator value. Only one of these is used.
	cdef public AwlOffset offset
	cdef public uint32_t immediate
	cdef public bytearray immediateBytes
	cdef public Pointer pointer

	cdef public _Bool isExtended
	cdef public object labelIndex
	cdef public uint32_t interfaceIndex
	cdef public _Bool compound
	cdef public object dataType

	cdef _cy_init(self)

	cdef __eq(self, AwlOperator other)

	cpdef AwlOperator dup(self)
	cpdef _Bool isImmediate(self)
	cpdef AwlOperator resolve(self, _Bool store=*)
	cpdef uint32_t makePointerValue(self)

cdef AwlOperator make_AwlOperator(uint32_t operType, int32_t width,
				   AwlOffset offset, AwlInsn insn)

cdef class AwlIndirectOp(AwlOperator):
	cdef public uint64_t area
	cdef public uint32_t addressRegister
	cdef public AwlOperator offsetOper

	cpdef AwlOperator dup(self)
	cpdef AwlOperator resolve(self, _Bool store=*)
	cpdef uint32_t makePointerValue(self)

cdef AwlIndirectOp make_AwlIndirectOp(uint64_t area,
				      int32_t width,
				      uint32_t addressRegister,
				      AwlOperator offsetOper,
				      AwlInsn insn)
