def initialize (mid_or_top, mid_format=nil, bottom_format=nil)
if (mid_or_top.nil?)
raise FormatException.new(),
" You need to pass in at least one non-nil argument"
end
@use_hash = false
@io = $stdout
@picture_lines = []
@vars = []
@top = @bottom = nil
@page_length = 60
@lines_left = @page_length
@format_length = 0
@buffered_lines = []
@print_top = true
@printed_a_body = false
@print_bottom = false
@page_number = 1
lines = ((mid_format.nil?) ? mid_or_top : mid_format)
if (lines.class == String)
lines = lines.split( /\n/ )
end
expected_vars = 0
lines.each {|line|
if (line =~ /^#.*/)
elsif (0 != expected_vars)
expected_vars = getVarLine(line, expected_vars)
else
expected_vars = getPictureLine(line, expected_vars)
@format_length += 1
end
}
setTop(mid_or_top) if mid_format
setBottom(bottom_format) if bottom_format
end