diff --git a/gnoemoe/gengtkclass.rb b/gnoemoe/gengtkclass.rb deleted file mode 100755 index 2fceba5..0000000 --- a/gnoemoe/gengtkclass.rb +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/ruby - -def replaceAll(line, subst) - subst.each do |sub,rep| - line = line.gsub('{' + sub + '}', rep) - end - - return line -end - -def degenerateCaps(text) - text = text.gsub(/[A-Z]+[a-z]+/) do |s| - s.downcase + '_' - end - - return text[0..-2] -end - -subst = {} -name = ARGV[0] -parent = ARGV[1] - -if (name == nil) then - print "Class name (capitalized): " - name = gets[0..-2] -end - -subst['template_'] = degenerateCaps(name) -subst['template-'] = subst['template_'].sub('_', '-') -subst['TEMPLATE'] = subst['template_'].upcase -subst['Template'] = name - -if (parent == nil) then - print "Parent name (capitalized): " - parent = gets[0..-2] -end - -subst['parent_'] = degenerateCaps(parent) -subst['parent-'] = subst['parent_'].sub('_', '-') -subst['PARENT'] = subst['parent_'].upcase -subst['Parent'] = parent - -tc = IO.readlines("gtktemplate.c") -th = IO.readlines("gtktemplate.h") - -f = File.open('gm-' + subst['template-'] + '.c', 'w') -tc.each do |line| - f.write(replaceAll(line, subst)) -end -f.close - -f = File.open('gm-' + subst['template-'] + '.h', 'w') -th.each do |line| - f.write(replaceAll(line, subst)) -end -f.close - -print "Done ...\n"