Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29149
Modified Files: Tag: devel_0_39 desire.tk Log Message: changed class_new, ${class}_new (now def $class init) so that it's more like Smalltalk/Ruby/Objc
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.47 retrieving revision 1.1.2.48 diff -C2 -d -r1.1.2.47 -r1.1.2.48 *** desire.tk 13 Sep 2005 20:00:50 -0000 1.1.2.47 --- desire.tk 13 Sep 2005 20:33:29 -0000 1.1.2.48 *************** *** 16,21 **** # there's already something else called class)
! proc class_new {name body} { ! proc ${name}_new {} $body }
--- 16,28 ---- # there's already something else called class)
! set nextid 0 ! proc class_new {name} { ! proc ${name}_new {args} " ! global nextid _ ! set self $nextid ! incr nextid ! set _($self:_class) $name ! eval [concat [list $self init] $args] ! " }
*************** *** 27,39 **** rename unknown _original_unknown proc unknown {args} { global _ ! if {[catch { ! set name $_($self:_class)_$selector ! set self [lindex $args 0] ! set selector [lindex $args 1] ! uplevel 1 [linsert [concat [list $self] [lrange $args 2 end] 0 $selector]] ! }]} { ! uplevel 1 [linsert $args 0 _original_unknown] } }
--- 34,49 ---- rename unknown _original_unknown proc unknown {args} { + puts "!!! unknown $args" global _ ! set self [lindex $args 0] ! set selector [lindex $args 1] ! if {[llength [array names _ $self:_class]] == 0} { ! return [uplevel 1 [linsert $args 0 _original_unknown]] } + set name $_($self:_class)_$selector + puts "proc name of $self $selector is $name" + set r [uplevel 1 [concat [list $name $self] [lrange $args 2 end]]] + puts "!!! /unknown $args" + return $r }
*************** *** 897,901 **** #-----------------------------------------------------------------------------------#
! class_new canvas { global offset_canvas _ set canvas_id [format %x [expr 0x80f2b50 + $offset_canvas]] --- 907,912 ---- #-----------------------------------------------------------------------------------#
! class_new canvas ! def canvas init {} { global offset_canvas _ set canvas_id [format %x [expr 0x80f2b50 + $offset_canvas]] *************** *** 1370,1374 ****
#-----------------------------------------------------------------------------------# ! class_new objectbox { global offset _ set canvas $_(focus) --- 1381,1386 ----
#-----------------------------------------------------------------------------------# ! class_new objectbox ! def objectbox init {} { global offset _ set canvas $_(focus) *************** *** 2903,2907 **** #-----------------------------------------------------------------------------------#
! class_new bang { global offset _ set offset [expr $offset + 1] --- 2915,2920 ---- #-----------------------------------------------------------------------------------#
! class_new bang ! def bang init {} { global offset _ set offset [expr $offset + 1]