# Path: zvm/zlogging.py
# def log(msg):
#   mainlog.debug(msg)


from .zlogging import log
  def pretty_print(self):
    "Display a ZRoutine nicely, for debugging purposes."

    log("ZRoutine:        start address: %d" % self.start_addr)
    log("ZRoutine: return value address: %d" % self.return_addr)
    log("ZRoutine:      program counter: %d" % self.program_counter)
    log("ZRoutine:      local variables: %d" % self.local_vars)


class ZStackBottom(object):

  def __init__(self):
    self.program_counter = 0  # used as a cache only


class ZStackManager(object):

  def __init__(self, zmem):

    self._memory = zmem
    self._stackbottom = ZStackBottom()
    self._call_stack = [self._stackbottom]


  def get_local_variable(self, varnum):
    """Return value of local variable VARNUM from currently-running
    routine.  VARNUM must be a value between 0 and 15, and must
    exist."""

    if self._call_stack[-1] == self._stackbottom:

# Path: zvm/zlogging.py
# def log(msg):
#   mainlog.debug(msg)


# Path: zvm/zstackmanager.py
from .zlogging import log

  def pretty_print(self):
    "Display a ZRoutine nicely, for debugging purposes."

    log("ZRoutine:        start address: %d" % self.start_addr)
    log("ZRoutine: return value address: %d" % self.return_addr)
    log("ZRoutine:      program counter: %d" % self.program_counter)
    log("ZRoutine:      local variables: %d" % self.local_vars)


class ZStackBottom(object):

  def __init__(self):
    self.program_counter = 0  # used as a cache only


class ZStackManager(object):

  def __init__(self, zmem):

    self._memory = zmem
    self._stackbottom = ZStackBottom()
    self._call_stack = [self._stackbottom]


  def get_local_variable(self, varnum):
    """Return value of local variable VARNUM from currently-running
    routine.  VARNUM must be a value between 0 and 15, and must
    exist."""

    if self._call_stack[-1] == self._stackbottom:

      raise ZStackNoRoutine