Files
cappuccino/Tools/Documentation/make_headers
T
Aparajita Fishman 89ce904850 Merge remote branch 'refs/remotes/280north/master' into my_master
Conflicts:
	AppKit/CPButton.j
	AppKit/Themes/Aristo/ThemeDescriptors.j
	AppKit/Themes/BlendKit/BKThemeDescriptor.j
	Foundation/CPArray.j
	Jakefile
	Tests/Foundation/CPArrayPerformanceTest.j
	Tools/Documentation/Cappuccino.doxygen
	Tools/Documentation/cleanup_headers
	Tools/Documentation/make_headers
2010-08-22 09:03:12 -04:00

41 lines
1.1 KiB
Ruby
Executable File

#! /usr/bin/env ruby
def makeHeaderFileFrom(fileName)
# Grab the entire file (text)
data = File.new(fileName).read
# Extract out all the "implementation" lines. Note, there may be
# more than on in a given .j file.
m = data.scan(/.*?(@implementation.*?\{.*?\})/m)
if m.length > 0
for i in 0...m.length
line = m[i][0]
# Skip category definitions
if not /.*?\(.*?\).*?\{/m.match(line)
# Extract the class name
m2 = line.scan(/.*?@implementation(.*?):.*/m)
if !m2.nil? && !m2[0].nil?
className = m2[0][0].strip()
# Change "implementation" to "interface", create the .h file, and write the interface
newLine = line.sub("implementation", "interface")
newFileName = File.dirname(fileName) + "/" + className + ".h"
f = File.new(newFileName, "w")
f.write(newLine + "\n@end")
f.close()
end
end
end
end
end
fileList = Dir['AppKit.doc/**/*.j'] + Dir['Foundation.doc/**/*.j']
for fileName in fileList
makeHeaderFileFrom(fileName)
end