[PD-cvs] externals/grill/py/scripts pak.py,1.1,1.2 script.py,1.2,1.3 sendrecv.py,1.5,1.6 simple.py,1.5,1.6

Thomas Grill xovo at users.sourceforge.net
Wed Jan 19 05:58:38 CET 2005


Update of /cvsroot/pure-data/externals/grill/py/scripts
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9250/scripts

Modified Files:
	pak.py script.py sendrecv.py simple.py 
Log Message:
- a bit more functions for the symbol type
- exporting symbol functions
corrected argument passing to class methods
updated for OSX
adjust pd and py files for correct argument passing


Index: pak.py
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/py/scripts/pak.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** pak.py	21 Aug 2004 04:13:47 -0000	1.1
--- pak.py	19 Jan 2005 04:58:35 -0000	1.2
***************
*** 9,14 ****
          self.lst = [0 for x in range(n)]
  
!     def _anything_(self,n,args):
!         # args should be type-checked!
!         self.lst[n-1] = args 
          self._outlet(1,self.lst)
--- 9,14 ----
          self.lst = [0 for x in range(n)]
  
!     def _anything_(self,n,arg):
!         # arg should be type-checked!
!         self.lst[n-1] = arg
          self._outlet(1,self.lst)

Index: simple.py
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/py/scripts/simple.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** simple.py	10 Jan 2005 05:00:56 -0000	1.5
--- simple.py	19 Jan 2005 04:58:35 -0000	1.6
***************
*** 1,5 ****
  # py/pyext - python script objects for PD and MaxMSP
  #
! # Copyright (c) 2002-2003 Thomas Grill (xovo at gmx.net)
  # For information on usage and redistribution, and for a DISCLAIMER OF ALL
  # WARRANTIES, see the file, "license.txt," in this distribution.  
--- 1,5 ----
  # py/pyext - python script objects for PD and MaxMSP
  #
! # Copyright (c) 2002-2005 Thomas Grill (gr at grrrr.org)
  # For information on usage and redistribution, and for a DISCLAIMER OF ALL
  # WARRANTIES, see the file, "license.txt," in this distribution.  
***************
*** 25,29 ****
  	[pyext script class arg1 arg2 arg3]
  
! 	then the __init__(self,args) function will be called with a tuple argument
  	args = (arg1,arg2,arg3) 
  	With this syntax, you will have to give at least one argument.
--- 25,29 ----
  	[pyext script class arg1 arg2 arg3]
  
! 	then the __init__(self,*args) function will be called with a tuple argument
  	args = (arg1,arg2,arg3) 
  	With this syntax, you will have to give at least one argument.
***************
*** 32,36 ****
  
  - Methods called by pyext
! 	The general format is 'tag_inlet(self,args)' resp. 'tag_inlet(self,*args)':
  		tag is the PD or MaxMSP message header.. either bang, float, list etc.
  		inlet is the inlet (starting from 1) from which messages are received.
--- 32,36 ----
  
  - Methods called by pyext
! 	The general format is 'tag_inlet(self,arg)' resp. 'tag_inlet(self,*args)':
  		tag is the PD or MaxMSP message header.. either bang, float, list etc.
  		inlet is the inlet (starting from 1) from which messages are received.
***************
*** 41,47 ****
  
  	You can also set up methods which react on any message. These have the special forms
! 		_anything_inlet(self,args)
  	or
! 		_anything_(self,inlet,args) 
  
  	Please see below for examples.
--- 41,47 ----
  
  	You can also set up methods which react on any message. These have the special forms
! 		_anything_inlet(self,*args)
  	or
! 		_anything_(self,inlet,*args) 
  
  	Please see below for examples.
***************
*** 90,94 ****
  		print "Float",f,"into first inlet"
  
! 	def list_1(self,s):
  		print "List",s,"into first inlet"
  
--- 90,94 ----
  		print "Float",f,"into first inlet"
  
! 	def list_1(self,*s):
  		print "List",s,"into first inlet"
  
***************
*** 108,112 ****
  		print "Tag 'go' into second inlet"
  
! 	def _anything_2(self,args):
  		print "Some other message into second inlet:",args
  
--- 108,112 ----
  		print "Tag 'go' into second inlet"
  
! 	def _anything_2(self,*args):
  		print "Some other message into second inlet:",args
  
***************
*** 117,121 ****
  		print "Tag 'onearg' into third inlet:",a
  
! 	def twoargs_3(self,a):
  		if len(a) == 2:
  			print "Tag 'twoargs' into third inlet:",a[0],a[1]
--- 117,121 ----
  		print "Tag 'onearg' into third inlet:",a
  
! 	def twoargs_3(self,*a):
  		if len(a) == 2:
  			print "Tag 'twoargs' into third inlet:",a[0],a[1]
***************
*** 123,127 ****
  			print "Tag 'twoargs': wrong number of arguments"
  
! 	def threeargs_3(self,a):
  		if len(a) == 3:
  			print "Tag 'threeargs' into third inlet",a[0],a[1],a[2]
--- 123,127 ----
  			print "Tag 'twoargs': wrong number of arguments"
  
! 	def threeargs_3(self,*a):
  		if len(a) == 3:
  			print "Tag 'threeargs' into third inlet",a[0],a[1],a[2]
***************
*** 150,154 ****
  		print "Tag 'hello' into inlet",n
  
! 	def _anything_(self,n,args):
  		print "Message into inlet",n,":",args
  
--- 150,154 ----
  		print "Tag 'hello' into inlet",n
  
! 	def _anything_(self,n,*args):
  		print "Message into inlet",n,":",args
  

Index: script.py
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/py/scripts/script.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** script.py	4 Jan 2003 04:36:49 -0000	1.2
--- script.py	19 Jan 2005 04:58:35 -0000	1.3
***************
*** 1,5 ****
  # py/pyext - python script objects for PD and MaxMSP
  #
! # Copyright (c) 2002-2003 Thomas Grill (xovo at gmx.net)
  # For information on usage and redistribution, and for a DISCLAIMER OF ALL
  # WARRANTIES, see the file, "license.txt," in this distribution.  
--- 1,5 ----
  # py/pyext - python script objects for PD and MaxMSP
  #
! # Copyright (c) 2002-2005 Thomas Grill (gr at grrrr.org)
  # For information on usage and redistribution, and for a DISCLAIMER OF ALL
  # WARRANTIES, see the file, "license.txt," in this distribution.  
***************
*** 23,27 ****
  def strlen(arg):   
  	"""Return the string length"""
! 	return len(arg)
  
  
--- 23,28 ----
  def strlen(arg):   
  	"""Return the string length"""
! 	# we must convert to string first (it's a symbol type most likely)
! 	return len(str(arg))
  
  

Index: sendrecv.py
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/py/scripts/sendrecv.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** sendrecv.py	11 Jan 2005 04:59:26 -0000	1.5
--- sendrecv.py	19 Jan 2005 04:58:35 -0000	1.6
***************
*** 1,5 ****
  # py/pyext - python script objects for PD and MaxMSP
  #
! # Copyright (c) 2002-2003 Thomas Grill (xovo at gmx.net)
  # For information on usage and redistribution, and for a DISCLAIMER OF ALL
  # WARRANTIES, see the file, "license.txt," in this distribution.  
--- 1,5 ----
  # py/pyext - python script objects for PD and MaxMSP
  #
! # Copyright (c) 2002-2005 Thomas Grill (gr at grrrr.org)
  # For information on usage and redistribution, and for a DISCLAIMER OF ALL
  # WARRANTIES, see the file, "license.txt," in this distribution.  
***************
*** 50,54 ****
  	sendname=""
  
! 	def recv(self,arg):
  		"""This is a class-local receive function, which has access to class members."""
  
--- 50,54 ----
  	sendname=""
  
! 	def recv(self,*arg):
  		"""This is a class-local receive function, which has access to class members."""
  
***************
*** 60,64 ****
  
  
! 	def __init__(self,args):
  		"""Class constructor"""
  
--- 60,64 ----
  
  
! 	def __init__(self,*args):
  		"""Class constructor"""
  
***************
*** 101,105 ****
  	recvname=""   
  
! 	def recv(self,arg):
  		"""This is a class-local receive function"""
  
--- 101,105 ----
  	recvname=""   
  
! 	def recv(self,*arg):
  		"""This is a class-local receive function"""
  





More information about the Pd-cvs mailing list