aboutsummaryrefslogtreecommitdiff
path: root/externals/gridflow/bin
diff options
context:
space:
mode:
authorN.N. <matju@users.sourceforge.net>2008-07-08 05:56:10 +0000
committerN.N. <matju@users.sourceforge.net>2008-07-08 05:56:10 +0000
commit089475041fe26964d72cb2ebc3559a36ba89a2f2 (patch)
tree4ea7537e82b2ee34748ef7cbfc18c523425d4f7a /externals/gridflow/bin
parentd1ad56f1da41e7a88eb9a52d6b0daaf145b54ea7 (diff)
trying to import gridflow 0.9.4
svn path=/trunk/; revision=10148
Diffstat (limited to 'externals/gridflow/bin')
-rwxr-xr-xexternals/gridflow/bin/backtrace18
-rwxr-xr-xexternals/gridflow/bin/check-help-version49
-rwxr-xr-xexternals/gridflow/bin/cvs-switch-user6
-rwxr-xr-xexternals/gridflow/bin/demangle4
-rw-r--r--externals/gridflow/bin/pd-tools.tcl37
-rwxr-xr-xexternals/gridflow/bin/pdnonegative66
-rwxr-xr-xexternals/gridflow/bin/plusminus39
-rwxr-xr-xexternals/gridflow/bin/valg5
8 files changed, 224 insertions, 0 deletions
diff --git a/externals/gridflow/bin/backtrace b/externals/gridflow/bin/backtrace
new file mode 100755
index 00000000..ac1358af
--- /dev/null
+++ b/externals/gridflow/bin/backtrace
@@ -0,0 +1,18 @@
+#!/usr/bin/env ruby
+if ARGV.length != 1
+ puts "usage: core.rb <corefile>"
+ exit 1
+end
+qfile=ARGV[0].gsub /'/, "\\\\'"
+x=`gdb --batch -c '#{qfile}'`.split"\n"
+m=/`([^']+)/.match x[0]
+f=File.open("/tmp/backtrace_#{$$}.gdb","w")
+f.puts"bt"
+f.puts"quit"
+f.close
+cmd="gdb #{m[1]} #{qfile} --command=/tmp/backtrace_#{$$}.gdb"
+x=`#{cmd}`.split("\n")
+i=nil
+x.each_with_index {|line,i| break if /^#0/ =~ line }
+x[0..i]=[]
+puts x
diff --git a/externals/gridflow/bin/check-help-version b/externals/gridflow/bin/check-help-version
new file mode 100755
index 00000000..cb067154
--- /dev/null
+++ b/externals/gridflow/bin/check-help-version
@@ -0,0 +1,49 @@
+#!/usr/bin/tclsh
+
+set argh0 [file normalize [file join [pwd] $argv0]]
+source [file dirname $argh0]/pd-tools.tcl
+
+set report {}
+
+proc find_version_strings {lines i} {
+ global filename report
+ lappend toplefts [list patate poil] ;# temporary dummy value so that subpatches are represented in the correct order
+ set j $i
+ set versions {}
+ while {$i < [llength $lines]} {
+ set list [split [lindex $lines $i] " "]
+ switch -- [lindex $list 1] {
+ text {
+ set comment [join [lrange $list 4 end] " "]
+ if {[regexp {^GridFlow (\d\.\d\.\d)} $comment v0 v1]} {
+ lappend versions $v1
+ }
+ }
+ connect {incr i; continue}
+ restore {break}
+ }
+ # recurse into subpatches (disabled because not necessary; can treat the file as one flat patch anyway)
+ ### if {[string compare [lindex $list 0] "#N"]==0} {set i [find_version_strings $lines [expr $i+1]]}
+ incr i
+ }
+ lappend report [list $filename [lsort $versions]]
+ return $i
+}
+
+foreach filename $argv {
+ set lines [pd_read_file $filename]
+ find_version_strings $lines 1
+}
+
+set env(PRINT_CLASS_LIST) yes
+set f [open "| pd -nogui -send {pd quit} 2&>1" r+]
+while {![eof $f]} {
+ if {[regexp {^class_new (.*)} [gets $f] m0 m1]} {
+ puts $m1
+ }
+}
+
+foreach line [lsort -decreasing -index 1 $report] {
+ foreach {filename versions} $line {}
+ puts [format "%40s: %s" $filename $versions]
+}
diff --git a/externals/gridflow/bin/cvs-switch-user b/externals/gridflow/bin/cvs-switch-user
new file mode 100755
index 00000000..9f4ab9ed
--- /dev/null
+++ b/externals/gridflow/bin/cvs-switch-user
@@ -0,0 +1,6 @@
+GFSOURCE=$(dirname $(dirname $(which "$0")))
+echo $1@cvs.gridflow.ca:/home/cvs/gridflow > CVS/Root
+for file in $(find $GFSOURCE -name Root)
+do
+ cp CVS/Root $file
+done
diff --git a/externals/gridflow/bin/demangle b/externals/gridflow/bin/demangle
new file mode 100755
index 00000000..923bca25
--- /dev/null
+++ b/externals/gridflow/bin/demangle
@@ -0,0 +1,4 @@
+#!/usr/bin/env ruby
+f = File.popen "gdb", "r+"
+f.puts "maintenance demangle #{ARGV[0]}", "quit"
+puts f.read.split("\n")[-2].sub(/^\(gdb\) /,"")
diff --git a/externals/gridflow/bin/pd-tools.tcl b/externals/gridflow/bin/pd-tools.tcl
new file mode 100644
index 00000000..2951b260
--- /dev/null
+++ b/externals/gridflow/bin/pd-tools.tcl
@@ -0,0 +1,37 @@
+# (this proc is taken from desiredata)
+# split at message boundaries.
+# \n is wiped, then that character is reused temporarily to mean a quoted semicolon.
+proc pd_mess_split {e} {
+ set r {}
+ regsub -all "\n" $e " " y
+ regsub -all {\\;} $y "\n" z
+ foreach mess [split $z ";"] {
+ regsub -all "\n" $mess "\\;" mess
+ set mess [string trimleft $mess]
+ if {$mess != ""} {lappend r $mess}
+ }
+ return $r
+}
+
+proc pd_read_file {filename} {
+ set f [open $filename]
+ set r [pd_mess_split [read $f]]
+ close $f
+ return $r
+}
+
+proc pd_pickle {l} {
+ set i 0
+ set t ""
+ set n [llength $l]
+ foreach e $l {
+ incr n -1
+ #regsub -all "," $e "\\," e
+ append t $e
+ incr i [string length $e]
+ if {$i>65} {set i 0; append t "\n"} elseif {$n>0} {incr i; append t " "}
+ }
+ append t ";"
+ return $t
+}
+
diff --git a/externals/gridflow/bin/pdnonegative b/externals/gridflow/bin/pdnonegative
new file mode 100755
index 00000000..d707f568
--- /dev/null
+++ b/externals/gridflow/bin/pdnonegative
@@ -0,0 +1,66 @@
+#!/usr/bin/tclsh
+
+set argh0 [file normalize [file join [pwd] $argv0]]
+source [file dirname $argh0]/pd-tools.tcl
+
+set toplefts {}
+
+# for the recursion to work properly, restore should be checked before #N, and the check
+# for #N shouldn't do "continue", as well as other tricky index stuff.
+proc find_top_left {lines i} {
+ global filename toplefts
+ set toplefts_i [llength $toplefts]
+ lappend toplefts [list patate poil] ;# temporary dummy value so that subpatches are represented in the correct order
+ set j $i
+ set xmin +9999; set ymin +9999
+ set xmax -9999; set ymax -9999
+ while {$i < [llength $lines]} {
+ set list [split [lindex $lines $i] " "]
+ if {[string compare [lindex $list 1] "connect"]==0} {incr i; continue}
+ if {[string compare [lindex $list 1] "restore"]==0} {break}
+ if {[string compare [lindex $list 0] "#N"]==0} {set i [find_top_left $lines [expr $i+1]]}
+ set x [lindex $list 2]; if {$xmin > $x} {set xmin $x}; if {$xmax < $x} {set xmax $x}
+ set y [lindex $list 3]; if {$ymin > $y} {set ymin $y}; if {$ymax < $y} {set ymax $y}
+ incr i
+ }
+ puts [format "filename=%-32s patch at lines %4d thru %4d has xmin=%d ymin=%d xmax=%d ymax=%d" $filename $j $i $xmin $ymin $xmax $ymax]
+ lset toplefts $toplefts_i [list $xmin $ymin]
+ return $i
+}
+
+# somewhat copy-pasted from the above, sorry.
+proc move_objects {lines i} {
+ global toplefts fout
+ set xymin [lindex $toplefts 0]
+ set xmin [lindex $xymin 0]; if {$xmin > 0} {set xmin 0}
+ set ymin [lindex $xymin 1]; if {$ymin > 0} {set ymin 0}
+ set toplefts [lrange $toplefts 1 end]
+ while {$i < [llength $lines]} {
+ set list [split [lindex $lines $i] " "]
+ if {[string compare [lindex $list 1] "connect"]==0} {puts $fout [pd_pickle $list]; incr i; continue}
+ if {[string compare [lindex $list 1] "restore"]==0} {break}
+ if {[string compare [lindex $list 0] "#N"]==0} {
+ puts $fout [pd_pickle $list]
+ set i [move_objects $lines [expr $i+1]]
+ set list [split [lindex $lines $i] " "]
+ }
+ set x [expr [lindex $list 2]-$xmin]
+ set y [expr [lindex $list 3]-$ymin]
+ set list [lreplace $list 2 3 $x $y]
+ puts $fout [pd_pickle $list]
+ incr i
+ }
+ return $i
+}
+
+foreach filename $argv {
+ set lines [pd_read_file $filename]
+ find_top_left $lines 1
+ #continue
+ set fout [open $filename.new w]
+ puts $fout [pd_pickle [lindex $lines 0]]
+ move_objects $lines 1
+ close $fout
+ exec mv $filename $filename.old
+ exec mv $filename.new $filename
+}
diff --git a/externals/gridflow/bin/plusminus b/externals/gridflow/bin/plusminus
new file mode 100755
index 00000000..685014ce
--- /dev/null
+++ b/externals/gridflow/bin/plusminus
@@ -0,0 +1,39 @@
+#!/usr/bin/env ruby
+# NOTE: this works with diff -u only!!!
+
+puts "-"*64
+
+$plustot=0
+$minustot=0
+
+def show
+ printf "%20s %+5d %+5d (net %+5d)\n", $file, $plus, -$minus, $plus-$minus
+end
+
+loop{
+ line = gets
+ break if not line
+ if /^diff/.match line then
+ x = line.split(/\s+/)
+ $plustot+=$plus if $plus
+ $minustot+=$minus if $minus
+ show if $file
+ $file = x[-1]
+ $on=false
+ $plus=0
+ $minus=0
+ elsif /^\@\@/ =~ line then $on=true
+ elsif $on and /^\+/ =~ line then $plus+=1
+ elsif $on and /^\-/ =~ line then $minus+=1
+ end
+}
+
+$plustot+=$plus if $plus
+$minustot+=$minus if $minus
+show if $file
+
+$file="total"
+$plus=$plustot
+$minus=$minustot
+puts "-"*64
+show
diff --git a/externals/gridflow/bin/valg b/externals/gridflow/bin/valg
new file mode 100755
index 00000000..de0f040a
--- /dev/null
+++ b/externals/gridflow/bin/valg
@@ -0,0 +1,5 @@
+GFSOURCE=$HOME/src/gridflow
+SUPPFILE=$GFSOURCE/tests/suppressions.valg3
+
+valgrind --suppressions=$SUPPFILE --gen-suppressions=yes "$@"
+