From 6a498f314d6974f1cdc09e1208105b758e45b2a9 Mon Sep 17 00:00:00 2001 From: Jesse van den Kieboom Date: Tue, 15 Nov 2005 12:03:47 +0000 Subject: [PATCH] Obsolete, genclass.rb handles everything now --- gnoemoe/gengtkclass.rb | 58 ------------------------------------------ 1 file changed, 58 deletions(-) delete mode 100755 gnoemoe/gengtkclass.rb 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"