Obsolete, genclass.rb handles everything now
This commit is contained in:
parent
4306ef8d88
commit
6a498f314d
|
@ -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"
|
Reference in New Issue