class SiSU_AO::Output

Public Class Methods

new(fn,md,data) click to toggle source
# File lib/sisu/ao.rb, line 391
def initialize(fn,md,data)
  @fn,@md,@data=fn,md,data
  @cf=SiSU_Env::CreateFile.new(@fn)
  @make=SiSU_Env::InfoFile.new(@fn)
  @dir=SiSU_Env::InfoEnv.new(@fn)
end

Public Instance Methods

hard_output() click to toggle source
# File lib/sisu/ao.rb, line 431
def hard_output
  if @md.opt.act[:maintenance][:set]==:on
    filename_meta=@cf.metaverse.file_meta
    @data.each {|o| filename_meta.puts o.inspect.sub(/:0x[0-9a-f]{8}\s/,': ')} #to make diffing easier
    filename_txt=@cf.metaverse.file_txt
    @data.each do |o|
      if defined? o.ocn
        filename_txt.puts case o.is
        when :heading
          "[#{o.is.to_s} #{o.lv}~#{o.name} [#{o.ocn}]] #{o.obj}"
        else "[#{o.is.to_s} [#{o.ocn}]] #{o.obj}"
        end
      else
        filename_txt.puts case o.is
        when :meta
          "[m~#{o.tag}] #{o.obj}"
        else "[#{o.is.to_s}] #{o.obj}"
        end
      end
    end
    filename_debug=@cf.file_debug
    @data.each do |o|
      if defined? o.ocn
        case o.is
        when :heading
          filename_debug.puts
            "#{o.is.to_s} #{o.lv}~#{o.name} odv=#{o.odv} osp=#{o.osp} [#{o.ocn}] -->\n\t#{o.obj}"
        end
      end
    end
  else
    hard="#{@dir.processing_path.ao}/#{@md.fns}.meta"
    File.unlink(hard) if FileTest.file?(hard)
    hard="#{@dir.processing_path.ao}/#{@md.fns}.txt"
    File.unlink(hard) if FileTest.file?(hard)
    hard="#{@dir.processing_path.ao}/#{@md.fns}.debug.txt"
    File.unlink(hard) if FileTest.file?(hard)
  end
end
idx_html_hard_output() click to toggle source
# File lib/sisu/ao.rb, line 478
def idx_html_hard_output
  if @md.book_idx \
  and @md.opt.act[:maintenance][:set]==:on
    filename_meta=@cf.file_meta_idx_html
    if @data.is_a?(Array)
      @data.each {|s| p s.inspect + "\n" unless s.is_a?(String)}
      @data.each {|s| filename_meta.puts s.strip + "\n" unless s.strip.empty?}
    end
  else
    hard_idx_html="#{@dir.processing_path.ao}/#{@md.fns}.idx.html"
    File.unlink(hard_idx_html) if FileTest.file?(hard_idx_html)
  end
end
make_marshal_content() click to toggle source
# File lib/sisu/ao.rb, line 470
def make_marshal_content
  marshal_ao=@make.marshal.ao_content
  File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} if @data.is_a?(Array)
end
make_marshal_idx_html() click to toggle source
# File lib/sisu/ao.rb, line 501
def make_marshal_idx_html
  marshal_ao=@make.marshal.ao_idx_html
  File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} \
    if @data.is_a?(Array)
end
make_marshal_idx_sst_html_seg() click to toggle source
# File lib/sisu/ao.rb, line 491
def make_marshal_idx_sst_html_seg
  marshal_ao=@make.marshal.ao_idx_sst_rel_html_seg
  File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} \
    if @data.is_a?(Array)
end
make_marshal_idx_sst_rel() click to toggle source
# File lib/sisu/ao.rb, line 496
def make_marshal_idx_sst_rel
  marshal_ao=@make.marshal.ao_idx_sst_rel
  File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} \
    if @data.is_a?(Array)
end
make_marshal_idx_xhtml() click to toggle source
# File lib/sisu/ao.rb, line 506
def make_marshal_idx_xhtml
  marshal_ao=@make.marshal.ao_idx_xhtml
  File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} \
    if @data.is_a?(Array)
end
make_marshal_map_name_ocn_htmlseg() click to toggle source
# File lib/sisu/ao.rb, line 516
def make_marshal_map_name_ocn_htmlseg
  marshal_ao=@make.marshal.ao_map_ocn_htmlseg
  File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} \
    if @data.is_a?(Hash)
end
make_marshal_map_nametags() click to toggle source
# File lib/sisu/ao.rb, line 511
def make_marshal_map_nametags
  marshal_ao=@make.marshal.ao_map_nametags
  File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} \
    if @data.is_a?(Hash)
end
make_marshal_metadata() click to toggle source
# File lib/sisu/ao.rb, line 474
def make_marshal_metadata
  marshal_ao=@make.marshal.ao_metadata
  File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} if @data.is_a?(Array)
end
screen_dump(o) click to toggle source
# File lib/sisu/ao.rb, line 397
def screen_dump(o)
  if defined? o.of
    print %{OF: #{o.of}; }
  end
  if defined? o.is
    print %{IS: #{o.is.to_s}; }
  end
  if defined? o.ocn
    print %{OCN: #{o.ocn}; }
  end
  if defined? o.node
    print %{NODE: #{o.node}; }
  end
  if defined? o.parent
    print %{Parent: #{o.parent}; }
  end
  if defined? o.obj and not o.obj.empty?
    puts %{\n#{o.obj}; }
  else "\n"
  end
end
screen_output(data) click to toggle source
# File lib/sisu/ao.rb, line 423
def screen_output(data)
  data.each do |o|
    print o.class
    screen_print(o.ocn)
    screen_print(o.obj)
    puts "\n"
  end
end
screen_print(t_o) click to toggle source
# File lib/sisu/ao.rb, line 418
def screen_print(t_o)
  if defined? t_o
    print ' ' + t_o.to_s
  end
end