module Byebug::ThreadFunctions

def display_context(c, show_top_frame=true)

:nodoc:
def display_context(c, show_top_frame=true)
  c_flag = c.thread == Thread.current ? '+' : ' '
  c_flag = '$' if c.suspended?
  d_flag = c.ignored? ? '!' : ' '
  print "%s%s", c_flag, d_flag
  print "%d ", c.thnum
  print "%s\t", c.thread.inspect
  if c.stack_size > 0 and show_top_frame
    print "%s:%d", c.frame_file(0), c.frame_line(0)
  end
  print "\n"
end

def parse_thread_num(subcmd, arg)

def parse_thread_num(subcmd, arg)
  if '' == arg
    errmsg "'%s' needs a thread number\n" % subcmd
    nil
  else
    thread_num = get_int(arg, "thread #{subcmd}", 1)
    return nil unless thread_num
    get_context(thread_num)
  end
end

def parse_thread_num_for_cmd(subcmd, arg)

def parse_thread_num_for_cmd(subcmd, arg)
  c = parse_thread_num(subcmd, arg)
  return nil unless c
  case
  when nil == c
    errmsg "No such thread.\n"
  when @state.context == c
    errmsg "It's the current thread.\n"
  when c.ignored?
    errmsg "Can't #{subcmd} to byebug's thread #{arg}.\n"
  else # Everything is okay
    return c
  end
  return nil
end