Method: #parse_tclConfig

Defined in:
ext/tk/extconf.rb,
ext/tk/old-extconf.rb

#parse_tclConfig(file) ⇒ Object



404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
# File 'ext/tk/extconf.rb', line 404

def parse_tclConfig(file)
  # check tclConfig.sh/tkConfig.sh
  tbl = Hash.new{|h,k| h[k] = ""}
  return tbl unless file
  IO.foreach(file){|line|
    line.strip!
    next if line !~ /^([^\#=][^=]*)=(['"]|)(.*)\2$/
    key, val = $1, $3
    tbl[key] = val.gsub(/\$\{([^}]+)\}/){|s|
      subst = $1
      (tbl[subst])? tbl[subst]: s
    } rescue nil
  }
  tbl
end