[Gridflow-cvs] [svn] commit: r3382 - /trunk/base/source_filter.rb

gridflow-cvs at artengine.ca gridflow-cvs at artengine.ca
Tue Apr 1 11:28:15 EDT 2008


Author: matju
Date: Tue Apr  1 11:28:15 2008
New Revision: 3382

Log:
don't use Ruby Symbol

Modified:
    trunk/base/source_filter.rb

Modified: trunk/base/source_filter.rb
==============================================================================
--- trunk/base/source_filter.rb (original)
+++ trunk/base/source_filter.rb Tue Apr  1 11:28:15 2008
@@ -116,7 +116,7 @@
 	name = type.slice!(/\w+$/)
 	raise "missing \\class #{where}" if
 		not $stack[-1] or not ClassDecl===frame
-	handle_decl "void ___get(Symbol s);" if frame.attrs.size==0
+	handle_decl "void ___get(t_symbol *s);" if frame.attrs.size==0
 	frame.attrs[name]=Attr.new(type,name,nil,virtual)
 	if virtual then
 		handle_decl "#{type} #{name}();"
@@ -241,26 +241,25 @@
 	Out.print "}; static FClass ci#{cl} = { #{cl}_allocator, #{cl}_startup,"
 	Out.print "#{cl.inspect}, COUNT(#{cl}_methods), #{cl}_methods };"
 #	STDERR.puts "attributes: "+
-	get="void ___get(Symbol s) {"
-	get << "Ruby _r_[3]={INT2NUM(convert(rb_ivar_get(rb_obj_class(rself),SI(@noutlets)),(int*)0)-1),s,Qnil};"
+	get="void ___get(t_symbol *s) {"
+	get << "Ruby _r_[3]={INT2NUM(convert(rb_ivar_get(rb_obj_class(rself),SI(@noutlets)),(int*)0)-1),ID2SYM(rb_intern(s->s_name)),Qnil};"
 	frame.attrs.each {|name,attr|
 		virtual = if attr.virtual then "(0,0)" else "" end
-		get << "if (s==SYM(#{name})) _r_[2]=R(#{name}#{virtual}).r; else "
+		get << "if (s==gensym(\"#{name})\")) _r_[2]=R(#{name}#{virtual}).r; else "
 		if frame.methods["_0_"+name].done then
 			STDERR.puts "skipping already defined \\attr #{name}"
 			next
 		end
 		type,name,default = attr.to_a
-		#STDERR.puts "type=#{type} name=#{name} default=#{default}"
-		handle_def "void _0_#{name} (#{type} #{name}) { this->#{name}=#{name}; }"
+		handle_def "0 #{name} (#{type} #{name}) { this->#{name}=#{name}; }"
 	}
 	startup2 = "@gfattrs = {"
 	frame.attrs.each {|name,attr|
 		startup2 += ":#{name} => [],"
 	}
 	startup2 += "}"
-	line.gsub!(/\{/,"{"+"IEVAL(rself,\"#{startup2}\");") or raise "\\startup line should have a '{' (sorry)"
-	get << "RAISE(\"unknown attr %s\",rb_sym_name(s)); send_out(3,_r_);}"
+	line.gsub!(/\{/,"{"+"IEVAL(rself,\"#{startup2}\");") or raise "\\classinfo line should have a '{' (sorry)"
+	get << "RAISE(\"unknown attr %s\",s->s_name); send_out(3,_r_);}"
 	handle_def get if frame.attrs.size>0
 	Out.print "void #{frame.name}_startup (Ruby rself) "+line.chomp
 end



More information about the Gridflow-cvs mailing list