Warning: this is an htmlized version!
The original is across this link,
and the conversion rules are here.
# ==============================================================================
# 
# 	RubyFORTH -- Copyright (C) 2007-8, Marc Simpson (GPL). 
# 
#	Inspection and introspection methods.
# 
# ==============================================================================

require 'kernel.rb'

# --[ Inspection ]--------------------------------------------------------------

$do_headers = /^do[CV].*/       # do{CREATE, COLON, CONSTANT, VARIABLE}

def ds_print
  i = 0
  0.upto($here-1) do |i| 
    c = $data_space[i]
    if c
      if c.class == String
        if c.match($do_headers)
          print "\n"
          printf("%3i)  ", i)
        end
      end
      print "#{c}, "
    end
    i += 1
  end
  print "\n\n"
end

def lookup_name(xt)
  if $context == "compiler"
    header = compiler_header(xt)
  end
  header = forth_header(xt) if header == nil
  header = 0 if header == nil
  header
end

def lookup_local_name(xt)
  header = nil
  header = compiler_words.index(xt) if $context == "compiler"
  header = forth_words.index(xt) if ! header
  header = 0 if ! header
  header
end

def inspect_ip
  contents = fetch($ip)
  header = lookup_name(contents)
  if contents == "lit"
    $ip += 1
    contents = fetch($ip)
    if contents.class == String
      print "'#{contents}'" 
    else
      print "#{fetch($ip)}"
    end
  elsif header == "branch" or header == "?branch"
    print "#{header} #{fetch($ip + 1)}"
    $ip += 1
  elsif contents == "dodoes"
    print "does>"
    $ip += 2
  elsif contents.class == String
    print contents
  else
    print(header) if header
  end
end

def see_docol
  # From $ip
  while fetch($ip) != "exit"
    inspect_ip
    print " "
    $ip += 1
  end
  puts "exit"
end

def see_docreate
  print "Primitive ==> 'doCREATE'"
  if ($ip + 2) != 0
    print "/does> "
    $ip = fetch($ip + 2)
    see_docol
  end
end

def _see(xt)
  header = fetch(xt)
  if header == "doCOL"
    $ip = xt
    return see_docol
  end
  if header == "doCREATE"
    $ip = xt
    return see_docreate
  end
  puts "Primitive ==> '#{header}'"
  return nil
end

def see
  xt = xt(parse_word)
  if xt == 0 
    puts "Error: word not found." 
    return nil
  end
  _see(xt)
end