add line numbers to array output

This commit is contained in:
Torsten Ruger 2018-08-12 13:58:58 +03:00
parent 3d113b4d83
commit 28b4a2b373

View File

@ -40,7 +40,7 @@ module Risc
# how many instruction up until the main starts, ie # how many instruction up until the main starts, ie
# ticks(main_at) will be the label for main # ticks(main_at) will be the label for main
def main_at def main_at
25 19
end end
def get_return def get_return
@ -122,9 +122,14 @@ module Risc
end end
def output_classes(classes) def output_classes(classes)
str = classes.to_s.gsub("Risc::","") str = " ["
all = str.split(",").each_slice(5).collect {|line| " " + line.join(",")} classes.each_with_index do |clazz , index|
puts all.join(",\n") str += "\n " if ((index)%5) == 0 and index != 0
str += clazz.name.split("::").last
str += ", "
str += "# #{index+1}" if ((index + 1)%10) == 0 and index != 0
end
puts "#{str}]"
puts "length = #{classes.length}" puts "length = #{classes.length}"
exit(1) exit(1)
end end