From 91c0003b158e5f0ed9d0677fb136ae8bb6f86ec5 Mon Sep 17 00:00:00 2001 From: "N.N." Date: Mon, 28 Apr 2008 18:10:15 +0000 Subject: this is an old gridflow, and there's already a svn repository at http://gridflow.ca/svn/trunk svn path=/trunk/; revision=9739 --- externals/gridflow/extra/puredata_format.rb | 129 ---------------------------- 1 file changed, 129 deletions(-) delete mode 100644 externals/gridflow/extra/puredata_format.rb (limited to 'externals/gridflow/extra/puredata_format.rb') diff --git a/externals/gridflow/extra/puredata_format.rb b/externals/gridflow/extra/puredata_format.rb deleted file mode 100644 index eaf32962..00000000 --- a/externals/gridflow/extra/puredata_format.rb +++ /dev/null @@ -1,129 +0,0 @@ -=begin - $Id: puredata_format.rb,v 1.2 2006-03-15 04:40:47 matju Exp $ - - GridFlow - Copyright (c) 2001,2002,2003 by Mathieu Bouchard - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - See file ../COPYING for further informations on licensing terms. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -=end - -class PureDataFileWriter - def initialize filename - @f = File.open filename, "w" - end - def close; @f.close end - def write_patcher o - pr = o.properties - @f.puts "#N canvas #{pr[:wx]} #{pr[:wy]} #{pr[:ww]} #{pr[:wh]} 10;" - ol = o.subobjects.keys - x=0 - ol.find_all {|a| a.classname=="inlet"}.sort {|a,b| a.argv[0] <=> b.argv[0] }.each {|a| - if x>a.properties[:x] - a.properties[:x]=x+16 - STDERR.puts "warning: moving inlet #{a.argv[0]} to the right" - end - x=a.properties[:x] - } - x=0 - ol.find_all {|a| a.classname=="outlet"}.sort {|a,b| a.argv[0] <=> b.argv[0] }.each {|a| - if x>a.properties[:x] - a.properties[:x]=x+16 - STDERR.puts "warning: moving outlet #{a.argv[0]} to the right" - end - x=a.properties[:x] - } - ol.each {|so| write_object so } - ol.each_with_index {|so,i| - next if not so.instance_eval{defined? @outlets} - so.outlets.each_with_index {|conns,outlet| - next if not conns - conns.each {|target,inlet| - @f.puts "#X connect #{i} #{outlet} #{ol.index target} #{inlet};" - } - } - } - end - - def list_to_s l - l.map {|x| - if Array===x then "( " + list_to_s(x) + " )" else escape(x.to_s) end - }.join " " - end - - # what am i supposed to do? - def escape x; x.gsub(/[;,]/) {|x| " \\#{x}" }.gsub(/\n/) {"\\\n"} end - def escape2 x; x.gsub(/[,]/) {|x| " \\#{x} " }.gsub(/[;\$\"]/) {|x| "\\#{x}" }.gsub(/\n/) {"\\\n"} end - - def write_object o - pr = o.properties - #classname = o.class.instance_eval{@foreign_name} - classname = o.classname - if classname=="jpatcher" - #@f.print "#N canvas 0 0 " - write_patcher o - end - - case classname - when "display"; classname="print" - when "list"; classname="listmake" - end - - t = case classname - when "jcomment"; "text" - when "messbox"; "msg" - when "jpatcher"; "restore" - when "intbox"; "floatatom" - else "obj" - end - @f.print "#X #{t} #{pr[:x]} #{pr[:y]} " - - case classname - when "button" - @f.print "bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1" - when "jcomment" - @f.print escape2(pr[:comment].to_s) - when "messbox" - av=o.argv[0] - i=0 - dollar="$".intern - while i