diff options
Diffstat (limited to 'externals/gridflow/bin')
-rwxr-xr-x | externals/gridflow/bin/backtrace | 18 | ||||
-rwxr-xr-x | externals/gridflow/bin/check-help-version | 49 | ||||
-rwxr-xr-x | externals/gridflow/bin/hpgl_move | 19 | ||||
-rwxr-xr-x | externals/gridflow/bin/make-compose-makefile | 30 | ||||
-rw-r--r-- | externals/gridflow/bin/pd-tools.tcl | 37 | ||||
-rwxr-xr-x | externals/gridflow/bin/pdnonegative | 66 | ||||
-rwxr-xr-x | externals/gridflow/bin/plusminus | 39 | ||||
-rwxr-xr-x | externals/gridflow/bin/svn-mv | 5 | ||||
-rwxr-xr-x | externals/gridflow/bin/valg | 5 |
9 files changed, 268 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/hpgl_move b/externals/gridflow/bin/hpgl_move new file mode 100755 index 00000000..f4bf0534 --- /dev/null +++ b/externals/gridflow/bin/hpgl_move @@ -0,0 +1,19 @@ +#!/usr/bin/env ruby +# Copyright (c) 2009 by Mathieu Bouchard + +x = Float ARGV[0] +y = Float ARGV[1] + +puts STDIN.read.split(/\s*;\s*/).map {|m| + h = m.slice!(0,2) + d = m.split(",") + case h + when "PA","PD","PU" + (0...d.length).each {|i| + off = if i%2==0 then x else y end + v = Float(d[i])+off + d[i] = if v==v.to_i then v.to_i else v.to_f end + } + end + h+d.join(",") +}.join(";") diff --git a/externals/gridflow/bin/make-compose-makefile b/externals/gridflow/bin/make-compose-makefile new file mode 100755 index 00000000..f7e5abca --- /dev/null +++ b/externals/gridflow/bin/make-compose-makefile @@ -0,0 +1,30 @@ +#!/usr/bin/env ruby + +f = File.read("../compose-8859-1.pdd").split(/\s*;\s*/) +g = File.open("Makefile","w") +g.puts "default:: all" +g.puts "" +list = [] + +[94,96,126,168,176,180,184].each {|a| + g.puts "#{a}u.hpgl: #{a}.hpgl Makefile" + dy = (if a==184 then 0 else 100 end) + g.puts "\t../../bin/hpgl_move 0 #{dy} < #{a}.hpgl > #{a}u.hpgl" + list << "#{a}u.hpgl" +} + +f.each {|char| + a,b,c = char.split(/\s+/).map {|x| Integer x } + [0,32].each {|o| + d = c.to_s + (if o==0 and c>47 then "u" else "" end) + g.puts "#{a+o}.hpgl: #{b+o}.hpgl #{d}.hpgl Makefile" + g.puts "\tcat #{b+o}.hpgl #{d}.hpgl > #{a+o}.hpgl" + g.puts "" + list << "#{a+o}.hpgl" + } +} + +g.puts "all:: "+list.join(" ") +g.puts "" +g.puts "clean::" +g.puts "\trm "+list.join(" ") 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/svn-mv b/externals/gridflow/bin/svn-mv new file mode 100755 index 00000000..0ddadd5f --- /dev/null +++ b/externals/gridflow/bin/svn-mv @@ -0,0 +1,5 @@ +#!/bin/bash +mv "$1" "$2" +svn remove "$1" +svn add "$2" +svn commit "$1" "$2" 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 "$@" + |