Module: TECSFlow

Defined in:
lib/tecsflow.rb

Class Method Summary collapse

Class Method Details

.analyze_call_port_func_name(fname) ⇒ Object



443
444
445
446
447
448
449
450
451
452
453
454
# File 'lib/tecsflow.rb', line 443

def self.analyze_call_port_func_name fname
  m = /-\>(?<cp>\w+)(?<subsc>(\[\])*)\.(?<func>\w+)__T/.match fname.to_s
  if m then
    call_port = m[:cp].to_sym
    function = m[:func].to_sym
    subsc = m[:subsc]
    subsc = nil if subsc == ""
    return [ call_port, function, subsc ]
  else
    return nil
  end
end

.mainObject



411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
# File 'lib/tecsflow.rb', line 411

def self.main
  doing = "nothing"
  begin
    print "reading '#{$tecsgen_dump_file_name}'\n"
    doing = "file reading"
    mar_in = File.read( $tecsgen_dump_file_name )
    TCFlow::Function.load_funclist $tecsgen_dump_file_name
    doing = "Marshal.load"
    $root_namespace = Marshal.load( mar_in )
    # ここではクラス変数を設定していないため、それらを参照するメソッドは使用できないことに注意!
  rescue => e
	pp e
    print "fatal: fail to load #{$tecsgen_dump_file_name} in #{doing}\n"
    exit 1
  end

  begin
    print "reading '#{$tcflow_dump_file_name}'\n"
    # doing = "file reading"
    # mar_in = File.read( $tcflow_dump_file_name )
    # doing = "Marshal.load"
    # $tcflow_funclist = Marshal.load( mar_in )
    $tcflow_funclist = TCFlow::Function.load_funclist $tcflow_dump_file_name
  rescue
    print "fatal: fail to load #{$tecsgen_dump_file_name} in #{doing}\n"
    exit 1
  end
  Namespace.set_root $root_namespace
  $root_namespace.print_all_cells
  print_unref_function
end


456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
# File 'lib/tecsflow.rb', line 456

def self.print_unref_function
  print "--- unreferenced entry functions ---\n"
  Cell.print_unused_func
  print "--- unreferenced C functions ---\n"
  TCFlow::Function.update
  $tcflow_funclist.each{ |fname, func|
    if func.kind_of? TCFlow::Function then
      if ! func.is_printed? && func.is_top? then
        print "[Function Out of TECS, unreferenced] ", func.get_name, "\n"
        func.print_all_functions 0
      end
    # else
    #   print_indent 0
    #   print fname, "\n"
    end
  }
end