[Gridflow-cvs] [svn] commit: r3435 - /trunk/base/flow_objects.rb

gridflow-cvs at artengine.ca gridflow-cvs at artengine.ca
Thu Apr 3 21:52:22 EDT 2008


Author: matju
Date: Thu Apr  3 21:52:21 2008
New Revision: 3435

Log:
cleanup

Modified:
    trunk/base/flow_objects.rb

Modified: trunk/base/flow_objects.rb
==============================================================================
--- trunk/base/flow_objects.rb (original)
+++ trunk/base/flow_objects.rb Thu Apr  3 21:52:21 2008
@@ -273,15 +273,6 @@
 	install "pd_netsocket", 2, 2
 end
 
-# make this with variable number of outlets?
-# what about moving this to desiredata?
-FObject.subclass("fork",1,2) {
-  def method_missing(sel,*args)
-    sel.to_s =~ /^_(\d)_(.*)$/ or super
-	send_out 1,$2.intern,*args
-	send_out 0,$2.intern,*args
-  end
-}
 FObject.subclass("shunt",2,0) {
 	gfattr :index
 	gfattr :mode
@@ -473,64 +464,19 @@
 # System, similar to shell
 FObject.subclass("system",1,1) { def _0_system(*a) system(a.join(" ")) end }
 
-=begin
-devices/linux
-
-AUTHOR
-        Mathieu Bouchard <matju at artengine.ca>
-        irc: irc.freenode.net / #ruby-lang / matju
-        (note: I can't read Japanese; write in French or English please)
-
-OVERVIEW
-This is a collection of simple modules that you extend IO objects with, to
-give them support for specific devices.  For example:
-
-        require "linux/SoundMixer"
-        f = File.open "/dev/mixer"
-        f.extend Linux::SoundMixer
-
-        # f now has special accessors for driver variables, e.g:
-
-        f.treble = left_speaker_percent + 256 * right_speaker_percent
-
-The modules are made of automatically generated methods, much like Ruby's
-accessors. those generators are called ioctl_reader, ioctl_writer,
-ioctl_accessor. Writing expects an integer in -2**31...2**31; reading will
-return the same. You may browse the source to find out which accessors are
-available, and it's easy to add support for more features.
-=end
-
 # general-purpose code for performing less-than-trivial IOCTL operations. (was part of devices4ruby)
 module IoctlClass
-	def ioctl_reader(sym,cmd_in)
-		module_eval %{def #{sym}
-			ioctl_intp_in(#{cmd_in})
-		end}
-	end
-	def ioctl_writer(sym,cmd_out)
-		module_eval %{def #{sym}=(v)
-			ioctl_intp_out(#{cmd_out},v)
-			#{sym} if respond_to? :#{sym}
-		end}
-	end
+	def ioctl_reader(sym,cmd_in)  module_eval %{def #{sym};    ioctl_intp_in( #{cmd_in})                                   end} end
+	def ioctl_writer(sym,cmd_out) module_eval %{def #{sym}=(v);ioctl_intp_out(#{cmd_out},v); #{sym} if respond_to? :#{sym} end} end
 	def ioctl_accessor(sym,cmd_in,cmd_out)
 		ioctl_reader(sym,cmd_in)
 		ioctl_writer(sym,cmd_out)
 	end
 end
 module Ioctl
-	def ioctl_intp_out(arg1,arg2)
-		ioctl(arg1,[arg2].pack("l"))
-	end
-	def ioctl_intp_in(arg1)
-		ioctl(arg1,s="blah")
-		return s.unpack("l")[0]
-	end
+	def ioctl_intp_out(arg1,arg2) ioctl(arg1,[arg2].pack("l")) end
+	def ioctl_intp_in(arg1)       ioctl(arg1,s="blah"); return s.unpack("l")[0] end
 end
-
-# Linux::ParallelPort
-# Copyright (c) 2001, 2003 by Mathieu Bouchard
-# this is published under the Ruby license
 
 =begin
   if using a DB-25 female connector as found on a PC,
@@ -551,11 +497,7 @@
   17 = -SELECT_IN
   18..25 = GROUND
 =end
-
-module Linux; module ParallelPort
-	extend IoctlClass
-	@port_flags = [LP_EXIST,LP_SELEC,LP_BUSY,LP_OFFL,LP_NOPA,LP_ERR,LP_ABORT,LP_CAREFUL,LP_ABORTOPEN,LP_TRUST_IRQ]
-	@port_status = [nil,nil,nil,LP_PERRORP,LP_PSELECD,LP_POUTPA,LP_PACK,LP_PBUSY]
+module Linux; module ParallelPort; extend IoctlClass
 	LPCHAR = 0x0601
 	LPCAREFUL = 0x0609 # obsoleted??? wtf?
 	LPGETSTATUS = 0x060b # return LP_S(minor)
@@ -593,8 +535,7 @@
   # outlet 0 reserved (future use)
 }
 
-module Linux; module SoundMixer
-	extend IoctlClass
+module Linux; module SoundMixer; extend IoctlClass
 	MIXER_READ_VOLUME  = 0x80044d00
 	MIXER_WRITE_VOLUME = 0xc0044d00
 	DEVICE_NAMES = ["vol", "bass", "treble", "synth", "pcm", "speaker", "line",



More information about the Gridflow-cvs mailing list