[PD-cvs] SF.net SVN: pure-data:[10474] branches/pd-devel/0.41.4/src

eighthave at users.sourceforge.net eighthave at users.sourceforge.net
Tue Jan 6 03:22:03 CET 2009


Revision: 10474
          http://pure-data.svn.sourceforge.net/pure-data/?rev=10474&view=rev
Author:   eighthave
Date:     2009-01-06 02:22:03 +0000 (Tue, 06 Jan 2009)

Log Message:
-----------
- pd now launches the new pd.tk and there is successful communication between pdand pd-gui. Next, I need to make pd_readsocket support inline carriage returns, since currently the eval is called line-by-line.

Modified Paths:
--------------
    branches/pd-devel/0.41.4/src/makefile.in
    branches/pd-devel/0.41.4/src/pd.tk
    branches/pd-devel/0.41.4/src/pd_menucommands.tcl
    branches/pd-devel/0.41.4/src/pd_menus.tcl
    branches/pd-devel/0.41.4/src/pkgIndex.tcl

Added Paths:
-----------
    branches/pd-devel/0.41.4/src/pd_connect.tcl

Modified: branches/pd-devel/0.41.4/src/makefile.in
===================================================================
--- branches/pd-devel/0.41.4/src/makefile.in	2009-01-03 09:15:08 UTC (rev 10473)
+++ branches/pd-devel/0.41.4/src/makefile.in	2009-01-06 02:22:03 UTC (rev 10474)
@@ -84,7 +84,7 @@
 .PHONY: pd gui externs all
 
 all: pd $(BIN_DIR)/pd-watchdog gui $(BIN_DIR)/pdsend \
-    $(BIN_DIR)/pdreceive  $(BIN_DIR)/pd.tk externs
+    $(BIN_DIR)/pdreceive  $(BIN_DIR)/pd.tk
 
 bin: pd $(BIN_DIR)/pd-watchdog gui $(BIN_DIR)/pdsend \
     $(BIN_DIR)/pdreceive  $(BIN_DIR)/pd.tk
@@ -126,8 +126,11 @@
 $(BIN_DIR)/pd-gui: $(GOBJ) $(GSRC)
 	cd ../obj; $(CC) $(INCLUDE) -o $(BIN_DIR)/$(GUINAME) $(GOBJ) $(GLIB)
 
-$(BIN_DIR)/pd.tk: u_main.tk $(BIN_DIR)
-	cp u_main.tk $(BIN_DIR)/pd.tk
+$(BIN_DIR)/pd.tk: $(wildcard *.tcl) $(wildcard locale/*.tcl) $(BIN_DIR)
+	install pd.tk $(BIN_DIR)/pd.tk
+	install *.tcl $(BIN_DIR)/
+	install -d $(BIN_DIR)/locale
+	install locale/*.tcl $(BIN_DIR)/locale
 	touch -r makefile.dependencies $(BIN_DIR)
 
 #this is for Max OSX only...
@@ -239,9 +242,25 @@
 
 include makefile.dependencies
 
+TAGS: etags
 
+etags:
+	etags *.[ch] 
+	find /usr/include -type f -name \*.h -exec etags -a '{}' \;
+	make etags_`uname -s`
 
+etags_Darwin:
+	find /System/Library/Frameworks  -type f -name \*.h -exec etags -a '{}' \;
+	find /Library/Frameworks  -type f -name \*.h -exec etags -a '{}' \;
+	find /sw/include -type f -name \*.h -exec etags -a '{}' \;
 
+etags_Linux:
 
+etags_MINGW:
+	find /usr/local/include/ -type f -name \*.h -exec etags -a '{}' \;
 
 
+
+
+
+

Modified: branches/pd-devel/0.41.4/src/pd.tk
===================================================================
--- branches/pd-devel/0.41.4/src/pd.tk	2009-01-03 09:15:08 UTC (rev 10473)
+++ branches/pd-devel/0.41.4/src/pd.tk	2009-01-06 02:22:03 UTC (rev 10474)
@@ -4,33 +4,56 @@
 # Copyright (c) 1997-2009 Miller Puckette.
 
 package require Tk
+
+## replace Tk widgets with Ttk widgets
 #package require tile
-
-## replace Tk widgets with Ttk widgets on 8.5
 #namespace import -force ttk::*
 
 # set . as first dir in auto_path
-set auto_path [linsert $auto_path 0 "/Users/hans/code/pure-data/branches/pd-devel/0.41.4/src"]
+#set auto_path [linsert $auto_path 0 "/Users/hans/code/pure-data/branches/pd-devel/0.41.4/src"]
 set auto_path [linsert $auto_path 0 "."]
 
+package require pd_connect
 package require pd_menus
 package require pd_bindings
 
+namespace import ::pd_connect::pd
+
 # ------------------------------------------------------------------------------
 # global variables
 # command line options
-array set cmd_ops {}
 
-for {set i 0} {$i < $argc} {incr i} {
-	global cmd_ops files_to_open
-	set o [lindex $argv $i]
-	switch -regexp -- $o {
-		^-lang\$ {incr i; set cmd_ops(lang) [lindex $argv $i]}
-		default {lappend files_to_open [lindex $argv $i]}
-	}
+
+# for the sake of clarity, I think there should not be any inline code,
+# everything should be in a procedure that is ultimately triggered from main()
+# -hans at eds.org
+
+#array set cmd_ops {}
+
+# the only arg for pd.tk is the port number to connect to 'pd' on, but this
+# code would be useful for opening files via drag-n-drop, the open panel, etc.
+#for {set i 0} {$i < $argc} {incr i} {
+#	global cmd_ops files_to_open
+#	set o [lindex $argv $i]
+#	switch -regexp -- $o {
+#		^-lang\$ {incr i; set cmd_ops(lang) [lindex $argv $i]}
+#		default {lappend files_to_open [lindex $argv $i]}
+#	}
+#}
+
+# no english support yet, so I am commenting this out
+#if {![info exists cmd_ops(lang)]} {set cmd_ops(lang) "en"}
+#init_locale
+
+# ------------------------------------------------------------------------------
+# quoting functions
+
+# enquote a string to send it to a tcl function
+proc pdtk_enquote {x} {
+    set foo [string map {"," "" ";" "" \" ""} $x]
+    set foo2 [string map {" " "\\ "} $foo]
+    concat $foo2
 }
-if {![info exists cmd_ops(lang)]} {set cmd_ops(lang) "en"}
-init_locale
 
 # ------------------------------------------------------------------------------
 # init functions
@@ -54,6 +77,20 @@
 	}
 }
 
+
+proc pdtk_pd_startup {version {args ""}} {
+	pdtk_post "version: $version"
+	pdtk_post "args: $args"
+	set oldtclversion 0
+	set fontlist "8 5 8 9 6 10 10 7 11 12 7 12 14 8 14 16 10 16 18 11 18 24 14 24 30 18 30 36 22 36"
+	pd [concat pd init [pdtk_enquote [pwd]] $oldtclversion $fontlist \;];
+}
+
+
+proc pdtk_post {s} {
+	puts stderr $s
+}
+
 # ------------------------------------------------------------------------------
 # canvas support functions
 proc pdtk_canvas_new {canvas_name width height} {
@@ -67,7 +104,8 @@
 
 # ------------------------------------------------------------------------------
 # main
-proc main {} {
+proc main {argc argv} {
+	pdtk_post "Starting pd.tk with main($argc $argv)"
 	init
 
 	wm title . "Pd-devel"
@@ -76,9 +114,11 @@
 	. configure -menu .menubar -width 400 -height 250
 	::pd_menus::configure_pdwindow .menubar
 	::pd_bindings::window_bindings .
+
+	::pd_connect::connect_to_pd [lindex $argv 0]
 }
 
-main
+main $argc $argv
 
 
 

Added: branches/pd-devel/0.41.4/src/pd_connect.tcl
===================================================================
--- branches/pd-devel/0.41.4/src/pd_connect.tcl	                        (rev 0)
+++ branches/pd-devel/0.41.4/src/pd_connect.tcl	2009-01-06 02:22:03 UTC (rev 10474)
@@ -0,0 +1,38 @@
+
+package provide pd_connect 0.1
+
+namespace eval ::pd_connect:: {
+	variable pd_socket
+
+	namespace export connect_to_pd
+	namespace export pd
+}
+
+proc ::pd_connect::connect_to_pd {portnumber} {
+	variable pd_socket
+	puts stderr "Connecting to 127.0.0.1 $portnumber ..."
+	if {[catch {set pd_socket [socket 127.0.0.1 $portnumber]}]} {
+		puts stderr "WARNING: connect to pd failed, retrying port $portnumber."
+		after 1000 ::pd_connect::connect_to_pd $portnumber
+		return
+	}
+	puts stderr "Connected to pd on port $portnumber"
+	fconfigure $pd_socket -blocking 1 -buffering line 
+	fileevent $pd_socket readable [list pd_readsocket $::pd_connect::pd_socket]
+}
+
+# send a message from Tcl to Pd
+proc ::pd_connect::pd {message} {
+	variable pd_socket
+	if {$pd_socket == ""} {error "Not connected to 'pd' process"}
+	puts $pd_socket $message
+}
+
+# figure out which namespace the eval is using... this probably needs to be
+# global so that eval runs in the global namespace
+proc pd_readsocket {pd_socket} {
+	set cmd_from_pd [gets $pd_socket]
+	puts stderr "cmd_from_pd $cmd_from_pd"
+	eval $cmd_from_pd
+#	eval [gets $pd_socket]
+}

Modified: branches/pd-devel/0.41.4/src/pd_menucommands.tcl
===================================================================
--- branches/pd-devel/0.41.4/src/pd_menucommands.tcl	2009-01-03 09:15:08 UTC (rev 10473)
+++ branches/pd-devel/0.41.4/src/pd_menucommands.tcl	2009-01-06 02:22:03 UTC (rev 10474)
@@ -5,13 +5,9 @@
 # PLACEHOLDERS
 
 namespace eval ::pd_menucommands:: {
-	namespace export pd
 	namespace export menu_*
 }
 
-proc ::pd_menucommands::pd {} {
-}
-
 proc ::pd_menucommands::menu_doc_open {docdir doc} {
 	# PLACEHOLDER
 }

Modified: branches/pd-devel/0.41.4/src/pd_menus.tcl
===================================================================
--- branches/pd-devel/0.41.4/src/pd_menus.tcl	2009-01-03 09:15:08 UTC (rev 10473)
+++ branches/pd-devel/0.41.4/src/pd_menus.tcl	2009-01-06 02:22:03 UTC (rev 10474)
@@ -21,6 +21,7 @@
 # for displaying on menus
 
 namespace eval ::pd_menus:: {
+	# TODO this should be only a variable declaration with the if in some kind of init()
 	if {[tk windowingsystem] eq "aqua"} {
 		variable accelerator "Meta"
 	} else {

Modified: branches/pd-devel/0.41.4/src/pkgIndex.tcl
===================================================================
--- branches/pd-devel/0.41.4/src/pkgIndex.tcl	2009-01-03 09:15:08 UTC (rev 10473)
+++ branches/pd-devel/0.41.4/src/pkgIndex.tcl	2009-01-06 02:22:03 UTC (rev 10474)
@@ -13,3 +13,4 @@
 package ifneeded pd_menucommands 0.1 [list source [file join $dir pd_menucommands.tcl]]
 package ifneeded pd_menus 0.1 [list source [file join $dir pd_menus.tcl]]
 package ifneeded pd_say 0.1 [list source [file join $dir pd_say.tcl]]
+package ifneeded pd_connect 0.1 [list source [file join $dir pd_connect.tcl]]


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Pd-cvs mailing list