changeset 8:2c0fd7bb4de6

Added a T in front of every template. Added support for interfaces as method parameters
author Jacob Carlborg <doob@me.com>
date Thu, 09 Jul 2009 22:16:40 +0200
parents 9e67a1122e85
children 3592b41928fe
files dsss.conf scripts/dgen.rb
diffstat 2 files changed, 11 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/dsss.conf	Thu Jul 09 21:17:39 2009 +0200
+++ b/dsss.conf	Thu Jul 09 22:16:40 2009 +0200
@@ -1,2 +1,3 @@
-[main.d]
-exlude += dstep/Cocoa
\ No newline at end of file
+[dstep]
+exlude += dstep/foundation
+exlude += dstep/appkit
\ No newline at end of file
--- a/scripts/dgen.rb	Thu Jul 09 21:17:39 2009 +0200
+++ b/scripts/dgen.rb	Thu Jul 09 22:16:40 2009 +0200
@@ -544,7 +544,7 @@
 			str << "mixin ObjcWrap".indent.nl
 			
 			templates_for_class(clazz.name).each do |template, value|
-				str << "mixin #{template}".indent.nl
+				str << "mixin #{get_identifier("T" + template)}".indent.nl
 			end
 			
 			str << "\n"
@@ -577,12 +577,12 @@
 		interfaces.each do |interface|
 			str = StringIO.new
 			
-			str << "interface I" # prepend I to the interface name, because it can be the same as a class name
+			str << "interface " # prepend I to the interface name, because it can be the same as a class name
 			
 			if interface == ""
-				str << get_identifier(interface.name).nl(false)
+				str << get_identifier("I" + interface.name).nl(false)
 			else
-				str << get_identifier(interface.name)
+				str << get_identifier("I" + interface.name)
 				
 				unless interface.parent == ""
 					str << " : "
@@ -629,7 +629,7 @@
 			str = StringIO.new
 
 			str << "template "			
-			str << get_identifier(template.name)
+			str << get_identifier("T" + template.name)
 			str << " ()".nl(false)
 			str << "{".nl(false)
 			str << interface_methods(template.method, template.name) if template["class"] == "NSObject"
@@ -1042,7 +1042,7 @@
 			end
 			
 			method.arg.each_with_index do |arg, i|
-				str << arg.name
+				str << get_identifier(arg.name)
 				str << ", " unless i == method.arg.length - 1
 			end unless method.arg.nil?
 			
@@ -1195,7 +1195,8 @@
 	# get_type("I", "I", "unsigned int")    #=> uint
 	#
 	def get_type (type, type64, declared_type)
-		
+		declared_type = "I" + $1 if declared_type =~ /\w+\s*<(.+)>/
+				
 		return get_identifier(declared_type) if type.nil? && type64.nil?
 			
 		t = check_declared_type(declared_type)