Revision: 10731 http://pure-data.svn.sourceforge.net/pure-data/?rev=10731&view=rev Author: eighthave Date: 2009-02-04 06:01:57 +0000 (Wed, 04 Feb 2009)
Log Message: ----------- cleaned up comments to be current and removed some debug puts
Modified Paths: -------------- branches/pd-devel/0.41.4/src/pd_connect.tcl
Modified: branches/pd-devel/0.41.4/src/pd_connect.tcl =================================================================== --- branches/pd-devel/0.41.4/src/pd_connect.tcl 2009-02-04 04:37:32 UTC (rev 10730) +++ branches/pd-devel/0.41.4/src/pd_connect.tcl 2009-02-04 06:01:57 UTC (rev 10731) @@ -30,12 +30,10 @@ # if pd-gui opens first, it creates socket and requests a port. The function # then returns the portnumber it receives. pd then connects to that port. proc ::pd_connect::create_socket {} { - puts "::pd_connect::create_socket" if {[catch {set sock [socket -server ::pd_connect::from_pd -myaddr localhost 0]}]} { puts stderr "ERROR: failed to allocate port, exiting!" exit 3 } - puts "sock $sock" return [lindex [fconfigure $sock -sockname] 2] }
@@ -47,8 +45,9 @@ }
# send a pd/FUDI message from Tcl to Pd. This function aims to behave like a -# [send] in Pd, except the first argument is the name to send to. -proc ::pd_connect::pdsend {message} { # 'args' is special, it gets everything +# [; message( in Pd. Basically, whatever is in quotes after the proc name +# will be sent as if it was sent from a message box with a leading semi-colon +proc ::pd_connect::pdsend {message} { variable pd_socket append message ; if {[catch {puts $pd_socket $message} errorname]} { @@ -57,12 +56,10 @@ } }
-# TODO exit if the other side drops the socket -# TODO this currently drops leading whitespace, like tabs proc ::pd_connect::pd_readsocket {cmd_from_pd} { variable pd_socket if {[eof $pd_socket]} { - # if we lose the socket connection, that means pd quit + # if we lose the socket connection, that means pd quit, so we quit close $pd_socket exit } @@ -73,7 +70,6 @@ switch -regexp -- $errorname { "missing close-brace" { # TODO consider using [info complete $cmd_from_pd] in a loop - puts stderr "appending another line" pd_readsocket $cmd_from_pd } "^invalid command name" { puts stderr "INVALID COMMAND NAME: $errorInfo"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.