#!/usr/bin/env ruby

text_exts = %w[
  txt
  pas
  dpr
  html
  htm
]

def cutsc(src)
  tmp = src + '~'
  File.rename src, tmp
  open(tmp, 'r'){|i|
  open(src, 'w'){|o|
    while i.gets
      sub!(/ stdcall;/, '')
      o.print
    end
  }}
end

Dir.glob('**/*'){|entry|
  pos = entry.rindex('.')
  next if pos.nil?
  ext = entry[pos+1..-1]
  if text_exts.include? ext
    $stderr.print "cutstdcl #{entry}\n"
    cutsc entry
  end
}
