aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/py
diff options
context:
space:
mode:
authorThomas Grill <xovo@users.sourceforge.net>2002-11-26 22:35:57 +0000
committerThomas Grill <xovo@users.sourceforge.net>2002-11-26 22:35:57 +0000
commit7017ea71b842451548451125d10acd5c27086e3b (patch)
treeee55af9f9f4f9b2b1c060545763e553a85e6963d /externals/grill/py
parentae094b15eab3b833bf69a8c26492dc022d09e5fb (diff)
""
svn path=/trunk/; revision=262
Diffstat (limited to 'externals/grill/py')
-rw-r--r--externals/grill/py/build-pd-cygwin.sh10
-rwxr-xr-xexternals/grill/py/build-pd-darwin.sh11
-rwxr-xr-xexternals/grill/py/build-pd-linux.sh2
-rw-r--r--externals/grill/py/config-pd-cygwin.txt29
-rwxr-xr-xexternals/grill/py/config-pd-darwin.txt31
-rw-r--r--externals/grill/py/config-pd-linux.txt8
-rw-r--r--externals/grill/py/config-pd-msvc.txt6
-rwxr-xr-xexternals/grill/py/makefile.pd-darwin72
-rw-r--r--externals/grill/py/makefile.pd-msvc58
-rw-r--r--externals/grill/py/pd/thread-1.pd94
-rw-r--r--externals/grill/py/py.mpw91
-rw-r--r--externals/grill/py/readme.txt20
-rw-r--r--externals/grill/py/scripts/threads.py5
-rw-r--r--externals/grill/py/source/bound.cpp2
-rw-r--r--externals/grill/py/source/main.cpp14
-rw-r--r--externals/grill/py/source/main.h6
-rw-r--r--externals/grill/py/source/modmeth.cpp2
-rw-r--r--externals/grill/py/source/py.cpp32
-rw-r--r--externals/grill/py/source/pyext.cpp12
-rw-r--r--externals/grill/py/source/pyext.h14
20 files changed, 288 insertions, 231 deletions
diff --git a/externals/grill/py/build-pd-cygwin.sh b/externals/grill/py/build-pd-cygwin.sh
deleted file mode 100644
index 8eb7bcab..00000000
--- a/externals/grill/py/build-pd-cygwin.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-
-. config-pd-cygwin.txt
-
-make -f makefile.pd-cygwin &&
-{
- if [ $INSTALL = "yes" ]; then
- make -f makefile.pd-cygwin install
- fi
-}
diff --git a/externals/grill/py/build-pd-darwin.sh b/externals/grill/py/build-pd-darwin.sh
new file mode 100755
index 00000000..edd03207
--- /dev/null
+++ b/externals/grill/py/build-pd-darwin.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+. config-pd-darwin.txt
+
+make -f makefile.pd-darwin &&
+{
+ if [ $INSTPATH != "" ]; then
+ echo Now install as root
+ sudo make -f makefile.pd-darwin install
+ fi
+}
diff --git a/externals/grill/py/build-pd-linux.sh b/externals/grill/py/build-pd-linux.sh
index 90e4a04a..421cb6e1 100755
--- a/externals/grill/py/build-pd-linux.sh
+++ b/externals/grill/py/build-pd-linux.sh
@@ -4,7 +4,7 @@
make -f makefile.pd-linux &&
{
- if [ $INSTALL = "yes" ]; then
+ if [ ${INSTPATH} != "" ]; then
echo Now install as root
su -c "make -f makefile.pd-linux install"
fi
diff --git a/externals/grill/py/config-pd-cygwin.txt b/externals/grill/py/config-pd-cygwin.txt
deleted file mode 100644
index 7c7bebd8..00000000
--- a/externals/grill/py/config-pd-cygwin.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-# py/pyext - python script objects for PD and Max/MSP
-# Copyright (c) 2002 Thomas Grill (xovo@gmx.net)
-#
-
-# where is PD?
-PDPATH=/cygdrive/c/programme/audio/pd
-
-# where do the flext libraries reside?
-FLEXTPATH=${PDPATH}/flext
-
-# which version of Python?
-PYTHONVER=python22
-
-# where are the python header files?
-PYTHONINCLUDE=/cygdrive/c/programme/prog/${PYTHONVER}/include
-
-# what is the python library file?
-PYTHONLIB=/cygdrive/c/programme/prog/${PYTHONVER}/libs/${PYTHONVER}.lib
-
-# where should the external(s) be built?
-TARGDIR=./pd-cygwin
-
-# should the external be installed? (yes/no)
-INSTALL=yes
-
-# where should the external be installed?
-INSTDIR=${PDPATH}/extra
-
-
diff --git a/externals/grill/py/config-pd-darwin.txt b/externals/grill/py/config-pd-darwin.txt
new file mode 100755
index 00000000..ce0275ad
--- /dev/null
+++ b/externals/grill/py/config-pd-darwin.txt
@@ -0,0 +1,31 @@
+# py/pyext - python script objects for PD and Max/MSP
+# Copyright (c) 2002 Thomas Grill (xovo@gmx.net)
+#
+# your c++ compiler (normally g++)
+CXX=g++
+
+# where are the PD header files?
+# leave it blank if it is a system directory (like /usr/local/include),
+# since gcc 3.2 complains about it
+PDPATH=/usr/local/pd/src
+
+# where is the PD executable?
+PD=/usr/local/pd/bin/pd
+
+# where do the flext libraries reside?
+FLEXTPATH=/usr/local/pd/flext
+
+# what is the python version?
+PYTHONVER=2.2
+# where are the python header files?
+PYTHONINCLUDE=/usr/include/python${PYTHONVER}
+# where is the python library file?
+PYTHONLIB=/Volumes/Daten/Prog/packs/Python-2.2.2
+
+# where should flext libraries be built?
+TARGDIR=./pd-darwin
+# where should the external be installed?
+# (leave blank to omit installation)
+INSTPATH=/usr/local/pd/extra
+
+
diff --git a/externals/grill/py/config-pd-linux.txt b/externals/grill/py/config-pd-linux.txt
index bc63be41..e3f6ccdf 100644
--- a/externals/grill/py/config-pd-linux.txt
+++ b/externals/grill/py/config-pd-linux.txt
@@ -3,7 +3,7 @@
#
# your c++ compiler (normally g++)
-CXX=g++-3.2
+CXX=g++
# where are the PD header files?
# leave it blank if it is a system directory (like /usr/local/include),
@@ -23,10 +23,8 @@ PYTHONLIB=/usr/lib/python${PYTHONVER}/config
# where should flext libraries be built?
TARGDIR=./pd-linux
-# should the flext stuff be installed? (yes/no)
-INSTALL=yes
-
-# where should py/pyext be installed?
+# where should the external be installed?
+# (leave blank to omit installation)
INSTPATH=/usr/local/lib/pd/extra
diff --git a/externals/grill/py/config-pd-msvc.txt b/externals/grill/py/config-pd-msvc.txt
index e5c4d044..3787eef1 100644
--- a/externals/grill/py/config-pd-msvc.txt
+++ b/externals/grill/py/config-pd-msvc.txt
@@ -9,7 +9,7 @@ PDPATH=c:\programme\audio\pd
FLEXTPATH=$(PDPATH)\flext
# where is MS VC++?
-MSVCPATH="c:\programme\prog\microsoft visual studio\VC98"
+MSVCPATH=c:\programme\prog\microsoft visual studio\VC98
# which version of Python?
PYTHONVER=python22
@@ -23,8 +23,6 @@ PYTHONLIB=c:\programme\prog\$(PYTHONVER)\libs\$(PYTHONVER).lib
# where should the external be built?
OUTPATH=pd-msvc
-# should the external be installed? (yes/no)
-INSTALL=yes
-
# where should the external be installed?
+# (leave blank to omit installation)
INSTDIR=$(PDPATH)\extra
diff --git a/externals/grill/py/makefile.pd-darwin b/externals/grill/py/makefile.pd-darwin
new file mode 100755
index 00000000..1351d834
--- /dev/null
+++ b/externals/grill/py/makefile.pd-darwin
@@ -0,0 +1,72 @@
+# py/pyext - python script objects for PD and Max/MSP
+# Copyright (C) 2002 Thomas Grill (xovo@gmx.net)
+#
+# Makefile for gcc @ darwin (OSX)
+#
+# usage:
+# to build run "make -f makefile.pd-darwin"
+# to install (as root), do "make -f makefile.pd-darwin install"
+#
+
+CONFIG=config-pd-darwin.txt
+
+include ${CONFIG}
+
+FLEXTLIB=${FLEXTPATH}/flext_t.a
+
+# compiler+linker stuff
+INCLUDES=${PDPATH} ${FLEXTPATH} ${PYTHONINCLUDE}
+LIBPATH= ${PYTHONLIB}
+FLAGS=-DPD -Dunix -DMACOSX -DFLEXT_THREADS
+CFLAGS=-O6 -Wno-unused -Wno-parentheses -Wno-switch -Wstrict-prototypes # -maltivec
+#CFLAGS=-g
+LIBS=m python${PYTHONVER}
+LDFLAGS=-bundle -bundle_loader ${PD}
+
+# ---------------------------------------------
+# the rest can stay untouched
+# ----------------------------------------------
+NAME=py
+
+# all the source files from the package
+SRCS=main.cpp py.cpp pyext.cpp bound.cpp clmeth.cpp modmeth.cpp pyargs.cpp register.cpp
+HDRS=main.h pyext.h
+
+
+DIR=source
+
+TARGET=$(TARGDIR)/$(NAME).pd_darwin
+MAKEFILE=makefile.pd-darwin
+
+# default target
+all: $(TARGDIR) $(TARGET)
+
+$(patsubst %,$(DIR)/%,$(SRCS)): $(patsubst %,$(DIR)/%,$(HDRS)) $(FLEXTLIB) $(MAKEFILE) $(CONFIG)
+ touch $@
+
+$(TARGDIR):
+ mkdir $(TARGDIR)
+
+$(TARGDIR)/%.o : $(DIR)/%.cpp
+ $(CXX) -c $(CFLAGS) $(FLAGS) $(patsubst %,-I%,$(INCLUDES)) $< -o $@
+
+$(TARGET) : $(patsubst %.cpp,$(TARGDIR)/%.o,$(SRCS)) $(FLEXTLIB)
+ $(CXX) $(LDFLAGS) $^ $(patsubst %,-L%,$(LIBPATH)) $(patsubst %,-l%,$(LIBS)) -o $@
+ chmod 755 $@
+
+$(INSTPATH):
+ mkdir $(INSTPATH)
+
+install:: $(INSTPATH)
+
+install:: $(TARGET)
+ cp $^ $(INSTPATH)
+# chown root.root $(patsubst %,$(INSTPATH)/%,$(notdir $^))
+# chmod 755 $(patsubst %,$(INSTPATH)/%,$(notdir $^))
+
+.PHONY: clean
+
+clean:
+ rm -f $(TARGDIR)/*.o $(TARGET)
+
+
diff --git a/externals/grill/py/makefile.pd-msvc b/externals/grill/py/makefile.pd-msvc
new file mode 100644
index 00000000..921a7a8d
--- /dev/null
+++ b/externals/grill/py/makefile.pd-msvc
@@ -0,0 +1,58 @@
+# py/pyext - python script object for PD and Max/MSP
+# Copyright (C) 2002 Thomas Grill (xovo@gmx.net)
+#
+# Makefile for MSVC++ 6
+#
+# usage:
+# to build run "make -f makefile.pd-msvc"
+#
+
+!include config-pd-msvc.txt
+
+# includes
+INCPATH=/I"$(MSVCPATH)\include" /I"$(PYTHONINCLUDE)" /I"$(PDPATH)\src" /I"$(FLEXTPATH)"
+LIBPATH=/LIBPATH:"$(MSVCPATH)\lib" /LIBPATH:"$(PDPATH)\bin" /LIBPATH:"$(FLEXTPATH)"
+LIBS=pd.lib pthreadVC.lib flext_t-pdwin.lib $(PYTHONLIB)
+
+# compiler definitions and flags
+DEFS=/DPD /DNT /DFLEXT_THREADS
+
+CFLAGS=/GR- /GX- /GD /G6 /Ox /MT
+
+# the rest can stay untouched
+# ----------------------------------------------
+
+# all the source files from the package
+SRCS= main.cpp py.cpp pyext.cpp modmeth.cpp clmeth.cpp register.cpp pyargs.cpp bound.cpp
+HDRS= main.h pyext.h
+
+# -----------------------------------------------
+
+NAME=py
+DIR=source
+
+all: $(OUTPATH) $(OUTPATH)\$(NAME).dll
+
+# remove build
+clean:
+ -del /q $(OUTPATH) > nul
+ -rmdir $(OUTPATH) > nul
+
+OBJS= $(SRCS:.cpp=.obj)
+
+$(OUTPATH):
+ -mkdir $(OUTPATH) > nul
+
+{$(DIR)}.cpp{}.obj:
+ cl /c /LD $(CFLAGS) $(DEFS) $(INCPATH) $** /Fo$(OUTPATH)\$@
+
+$(OUTPATH)\$(NAME).dll: $(OBJS)
+ cd $(OUTPATH)
+ link /DLL /out:$(NAME).dll /INCREMENTAL:NO $** $(LIBS) $(LIBPATH)
+ @-del *.exp
+ @-del *.lib
+ cd ..
+!ifdef INSTPATH
+ @-if not exist $(INSTPATH) mkdir $(INSTPATH)
+ copy $@ $(INSTPATH) > nul
+!endif
diff --git a/externals/grill/py/pd/thread-1.pd b/externals/grill/py/pd/thread-1.pd
index 892c37ce..9a873781 100644
--- a/externals/grill/py/pd/thread-1.pd
+++ b/externals/grill/py/pd/thread-1.pd
@@ -1,47 +1,47 @@
-#N canvas 307 249 576 388 12;
-#X msg 38 265 help;
-#X msg 37 290 doc;
-#X msg 73 291 doc+;
-#X floatatom 145 323 5 0 0;
-#X text 16 14 py/pyext - Python script objects \, (C)2002 Thomas Grill
-;
-#X text 14 44 This demonstrates threading. See the threads.py file.
-;
-#X obj 145 279 pyext threads ex1;
-#X obj 140 216 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
-1;
-#X msg 140 236 detach \$1;
-#X floatatom 253 324 5 0 0;
-#X obj 275 123 bng 15 250 50 0 empty empty empty 0 -6 0 8 -258699 -1
--1;
-#X obj 146 127 bng 15 250 50 0 empty empty empty 0 -6 0 8 -258699 -1
--1;
-#X obj 146 154 t b b b;
-#X obj 275 150 t b b b;
-#X obj 289 179 1;
-#X obj 160 181 0;
-#X text 87 87 without threads;
-#X text 113 105 blocking;
-#X text 251 85 with threads;
-#X text 252 102 non-blocking;
-#X text 178 345 watch that!;
-#X msg 414 127 stop;
-#X text 384 106 you can even stop it;
-#X connect 0 0 6 0;
-#X connect 1 0 6 0;
-#X connect 2 0 6 0;
-#X connect 6 0 3 0;
-#X connect 6 1 9 0;
-#X connect 7 0 8 0;
-#X connect 8 0 6 0;
-#X connect 10 0 13 0;
-#X connect 11 0 12 0;
-#X connect 12 0 6 1;
-#X connect 12 1 6 2;
-#X connect 12 2 15 0;
-#X connect 13 0 6 1;
-#X connect 13 1 6 2;
-#X connect 13 2 14 0;
-#X connect 14 0 7 0;
-#X connect 15 0 7 0;
-#X connect 21 0 6 0;
+#N canvas 440 61 586 398 12;
+#X msg 38 265 help;
+#X msg 37 290 doc;
+#X msg 73 291 doc+;
+#X floatatom 145 323 5 0 0;
+#X text 16 14 py/pyext - Python script objects \, (C)2002 Thomas Grill
+;
+#X text 14 44 This demonstrates threading. See the threads.py file.
+;
+#X obj 140 216 tgl 15 0 empty empty empty 0 -6 32 8 -262144 -1 -1 0
+1;
+#X msg 140 236 detach \$1;
+#X floatatom 253 324 5 0 0;
+#X obj 275 123 bng 15 250 50 0 empty empty empty 0 -6 32 8 -258699
+-1 -1;
+#X obj 146 127 bng 15 250 50 0 empty empty empty 0 -6 32 8 -258699
+-1 -1;
+#X obj 146 154 t b b b;
+#X obj 275 150 t b b b;
+#X obj 289 179 1;
+#X obj 160 181 0;
+#X text 87 87 without threads;
+#X text 251 85 with threads;
+#X text 252 102 non-blocking;
+#X text 178 345 watch that!;
+#X msg 414 127 stop;
+#X text 384 106 you can even stop it;
+#X text 115 102 blocking;
+#X obj 145 279 pyext threads ex1;
+#X connect 0 0 22 0;
+#X connect 1 0 22 0;
+#X connect 2 0 22 0;
+#X connect 6 0 7 0;
+#X connect 7 0 22 0;
+#X connect 9 0 12 0;
+#X connect 10 0 11 0;
+#X connect 11 0 22 1;
+#X connect 11 1 22 2;
+#X connect 11 2 14 0;
+#X connect 12 0 22 1;
+#X connect 12 1 22 2;
+#X connect 12 2 13 0;
+#X connect 13 0 6 0;
+#X connect 14 0 6 0;
+#X connect 19 0 22 0;
+#X connect 22 0 3 0;
+#X connect 22 1 8 0;
diff --git a/externals/grill/py/py.mpw b/externals/grill/py/py.mpw
deleted file mode 100644
index 54c507a0..00000000
--- a/externals/grill/py/py.mpw
+++ /dev/null
@@ -1,91 +0,0 @@
-# py - python script object for PD and MaxMSP
-# Copyright (c) 2002 Thomas Grill (xovo@gmx.net)
-#
-# Makefile for Apple MPW-PR
-#
-# usage: make -f py.mpw
-#
-# ---------------------------------------------
-
-MAKEFILE = py.mpw
-€MondoBuild€ = {MAKEFILE} # Make blank to avoid rebuilds when makefile is modified
-
-Name = py
-
-ObjDir = :MPW:
-MaxSDK = HD Daten:Prog Stuff:Max/MSP SDK:SDK Examples
-flext = ::flext:
-Python = HD Daten:Prog Stuff:Packs:Python-2.2
-PythonIncludes = {Python}:Include
-PythonMacIncludes = {Python}:Mac:Include
-PythonCore = HD MacOS:Applications (Mac OS 9):dev:Python 2.2:PythonCore
-
-
-
-Includes = -i :,"{flext}","{MaxSDK}:Max Includes","{MaxSDK}:MSP Includes","{GUSI}include","{PythonIncludes}","{PythonMacIncludes}"
-### MPW Shell - Command "Includes" was not found.
-
-Defines = -d MAXMSP -d USE_GUSI2
-
-Sym-PPC = -sym off
-Flags = -bool on -enum int -includes unix -opt speed,unroll,unswitch
-
-
-PPCCPlusOptions = {Includes} {Sym-PPC} {Defines} {Flags}
-
-
-### Source Files ###
-
-SrcFiles = main.cpp
-Headers =
-
-
-### Object Files ###
-
-Obj-PPC = 
- "{ObjDir}main.cpp.x"
-
-LibFiles-Ext = 
- "{flext}MPW:flext.o" 
- "{MaxSDK}:Max Includes:MaxLib" 
- "{MaxSDK}:MSP Includes:MaxAudioLib" 
- "{PythonCore}"
-
-### Libraries ###
-
-LibFiles-PPC = 
- "{SharedLibraries}StdCLib" 
- "{SharedLibraries}MathLib" 
- "{PPCLibraries}StdCRuntime.o" 
- "{PPCLibraries}PPCCRuntime.o" 
- "{PPCLibraries}MrCPlusLib.o" 
-
-
-### Default Rules ###
-
-{ObjDir} Ÿ :
-
-.cpp.x Ÿ .cpp {€MondoBuild€} {Headers}
- {PPCCPlus} {depDir}{default}.cpp -o {targDir}{default}.cpp.x {PPCCPlusOptions}
-
-
-### Build Rules ###
-
-all Ÿ Folder {€MondoBuild€} {ObjDir}{Name}
-
-Folder ŸŸ
- if !`Exists {ObjDir}` ; NewFolder {ObjDir} ; end
-
-{ObjDir}{Name} Ÿ {Obj-PPC}
- PPCLink 
- -o {Targ} 
- {deps} 
- {LibFiles-Ext} 
- {LibFiles-PPC} 
- {Sym-PPC} 
- -mf -d 
- -t 'iLaF' 
- -c 'max2' 
- -xm s 
- -export main 
- -main main
diff --git a/externals/grill/py/readme.txt b/externals/grill/py/readme.txt
index fc82880b..3173ce04 100644
--- a/externals/grill/py/readme.txt
+++ b/externals/grill/py/readme.txt
@@ -21,7 +21,7 @@ Package files:
Goals/features of the package:
-Access the flexibility of the python language in PD/MaxMSP
+Access the flexibility of the python language in PD and MaxMSP
PD - Load it as i library with e.g. "pd -lib py -path scripts"
@@ -38,6 +38,11 @@ With the pyext you can use python classes to represent full-featured pd/Max mess
Multithreading (detached methods) is supported for both objects.
You can send messages to named objects or receive (with pyext) with Python methods.
+
+Known bugs:
+There are problems with importing the "time" module, experienced with Python 2.2.2 under OSX.
+Therefore, some help patches may not be functional.
+
----------------------------------------------------------------------------
The py/pyext package should run with Python version >= 2.1.
@@ -46,28 +51,35 @@ It has been thoroughly tested with version 2.2
The package should at least compile (and is tested) with the following compilers:
-pd - Windows:
+PD @ Windows:
-------------
o Borland C++ 5.5 (free): edit "config-pd-bcc.txt" & run "build-pd-bcc.bat"
-o Microsoft Visual C++ 6: edit the project file "py.dsp" & build
+o Microsoft Visual C++ 6: usr "py.dsp" or edit "config-pd-msvc.txt" & run "build-pd-msvc.bat"
-pd - linux:
+PD @ linux:
-----------
Python doesn't provide a shared lib by default - static linking produces huge externals
Ok, debian is an exception... the precompiled binary is for debian, therefore.
o GCC: edit "config-pd-linux.txt" & run "sh build-pd-linux.sh"
+PD @ MacOSX:
+---------------------
+
+o GCC: edit "config-pd-darwin.txt" & run "sh build-pd-darwin.sh"
+
----------------------------------------------------------------------------
Version history:
0.1.1:
+- CHANGE: updates for flext 0.4.0
- FIX: crash when module couldn't be loaded
- FIX: GetBound method (modmeth.cpp, line 138) doesn't exist in flext any more
- FIX: deadlock occured when connecting to py/pyext boxes in non-detached mode
- ADD: current path and path of the canvas is added to the python path
+- FIX: path is not added to python path if already included
0.1.0:
- completely reworked all code
diff --git a/externals/grill/py/scripts/threads.py b/externals/grill/py/scripts/threads.py
index e8486699..f7740bd3 100644
--- a/externals/grill/py/scripts/threads.py
+++ b/externals/grill/py/scripts/threads.py
@@ -29,11 +29,11 @@ class ex1(pyext._class):
_outlets=2
sltime=0.2 # sleep time
- loops=30 # loops to iterate
+ loops=20 # loops to iterate
# method for bang to any inlet
def bang_(self,n):
- for i in range(30):
+ for i in range(self.loops):
# if _shouldexit is true, the thread ought to stop
if self._shouldexit: break
@@ -41,3 +41,4 @@ class ex1(pyext._class):
sleep(self.sltime)
+
diff --git a/externals/grill/py/source/bound.cpp b/externals/grill/py/source/bound.cpp
index 651bb52b..f402480b 100644
--- a/externals/grill/py/source/bound.cpp
+++ b/externals/grill/py/source/bound.cpp
@@ -14,7 +14,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
t_class *pyext::px_class;
pyext::py_proxy *pyext::px_head,*pyext::px_tail;
-void pyext::py_proxy::px_method(py_proxy *obj,const t_symbol *s,int argc,t_atom *argv)
+void pyext::py_proxy::px_method(py_proxy *obj,const t_symbol *s,int argc,const t_atom *argv)
{
PY_LOCK
diff --git a/externals/grill/py/source/main.cpp b/externals/grill/py/source/main.cpp
index 65e1d274..2522ff51 100644
--- a/externals/grill/py/source/main.cpp
+++ b/externals/grill/py/source/main.cpp
@@ -10,7 +10,6 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#include "main.h"
-
V py::lib_setup()
{
post("");
@@ -127,7 +126,7 @@ V py::m_doc()
-V py::SetArgs(I argc,t_atom *argv)
+V py::SetArgs(I argc,const t_atom *argv)
{
// script arguments
C **sargv = new C *[argc+1];
@@ -202,8 +201,15 @@ V py::AddToPath(const C *dir)
if(dir && *dir) {
PyObject *pobj = PySys_GetObject("path");
if(pobj && PyList_Check(pobj)) {
- PyObject *ps = PyString_FromString(dir);
- PyList_Append(pobj,ps);
+ int i,n = PyList_Size(pobj);
+ for(i = 0; i < n; ++i) {
+ PyObject *pt = PyList_GetItem(pobj,i);
+ if(PyString_Check(pt) && !strcmp(dir,PyString_AsString(pt))) break;
+ }
+ if(i == n) { // string is not yet existent in path
+ PyObject *ps = PyString_FromString(dir);
+ PyList_Append(pobj,ps);
+ }
}
PySys_SetObject("path",pobj);
}
diff --git a/externals/grill/py/source/main.h b/externals/grill/py/source/main.h
index 66b332cf..b4096819 100644
--- a/externals/grill/py/source/main.h
+++ b/externals/grill/py/source/main.h
@@ -21,7 +21,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#error You need at least flext version 0.4.0
#endif
-#define PY__VERSION "0.1.1pre3"
+#define PY__VERSION "0.1.1"
#define PYEXT_MODULE "pyext" // name for module
@@ -66,7 +66,7 @@ protected:
V GetModulePath(const C *mod,C *dir,I len);
V AddToPath(const C *dir);
- V SetArgs(I argc,t_atom *argv);
+ V SetArgs(I argc,const t_atom *argv);
V ImportModule(const C *name);
V ReloadModule();
@@ -98,7 +98,7 @@ protected:
// ----thread stuff ------------
V m_detach(BL det) { detach = det; }
- virtual V m_stop(int argc,t_atom *argv);
+ virtual V m_stop(int argc,const t_atom *argv);
BL detach,shouldexit;
I thrcount;
diff --git a/externals/grill/py/source/modmeth.cpp b/externals/grill/py/source/modmeth.cpp
index 51e103ed..b7d2cab0 100644
--- a/externals/grill/py/source/modmeth.cpp
+++ b/externals/grill/py/source/modmeth.cpp
@@ -66,7 +66,7 @@ V py::tick(py *th)
th->Unlock();
}
-V py::m_stop(int argc,t_atom *argv)
+V py::m_stop(int argc,const t_atom *argv)
{
if(thrcount) {
Lock();
diff --git a/externals/grill/py/source/py.cpp b/externals/grill/py/source/py.cpp
index 83c5d9b5..eff88daf 100644
--- a/externals/grill/py/source/py.cpp
+++ b/externals/grill/py/source/py.cpp
@@ -17,29 +17,29 @@ class pyobj:
FLEXT_HEADER(pyobj,py)
public:
- pyobj(I argc,t_atom *argv);
+ pyobj(I argc,const t_atom *argv);
~pyobj();
protected:
- BL m_method_(I n,const t_symbol *s,I argc,t_atom *argv);
+ BL m_method_(I n,const t_symbol *s,I argc,const t_atom *argv);
- V work(const t_symbol *s,I argc,t_atom *argv);
+ V work(const t_symbol *s,I argc,const t_atom *argv);
V m_bang() { work(sym_bang,0,NULL); }
V m_reload();
- V m_reload_(I argc,t_atom *argv);
- V m_set(I argc,t_atom *argv);
+ V m_reload_(I argc,const t_atom *argv);
+ V m_set(I argc,const t_atom *argv);
V m_doc_();
virtual V m_help();
// methods for python arguments
- V callwork(const t_symbol *s,I argc,t_atom *argv);
+ V callwork(const t_symbol *s,I argc,const t_atom *argv);
- V m_py_list(I argc,t_atom *argv) { callwork(sym_list,argc,argv); }
- V m_py_float(I argc,t_atom *argv) { callwork(sym_float,argc,argv); }
- V m_py_int(I argc,t_atom *argv) { callwork(sym_int,argc,argv); }
- V m_py_any(const t_symbol *s,I argc,t_atom *argv) { callwork(s,argc,argv); }
+ V m_py_list(I argc,const t_atom *argv) { callwork(sym_list,argc,argv); }
+ V m_py_float(I argc,const t_atom *argv) { callwork(sym_float,argc,argv); }
+ V m_py_int(I argc,const t_atom *argv) { callwork(sym_int,argc,argv); }
+ V m_py_any(const t_symbol *s,I argc,const t_atom *argv) { callwork(s,argc,argv); }
const t_symbol *funname;
PyObject *function;
@@ -72,7 +72,7 @@ private:
FLEXT_LIB_V("py",pyobj)
-pyobj::pyobj(I argc,t_atom *argv):
+pyobj::pyobj(I argc,const t_atom *argv):
function(NULL),funname(NULL)
{
PY_LOCK
@@ -139,7 +139,7 @@ pyobj::~pyobj()
-BL pyobj::m_method_(I n,const t_symbol *s,I argc,t_atom *argv)
+BL pyobj::m_method_(I n,const t_symbol *s,I argc,const t_atom *argv)
{
if(n == 1)
post("%s - no method for type %s",thisName(),GetString(s));
@@ -160,7 +160,7 @@ V pyobj::m_reload()
PY_UNLOCK
}
-V pyobj::m_reload_(I argc,t_atom *argv)
+V pyobj::m_reload_(I argc,const t_atom *argv)
{
PY_LOCK
SetArgs(argc,argv);
@@ -169,7 +169,7 @@ V pyobj::m_reload_(I argc,t_atom *argv)
m_reload();
}
-V pyobj::m_set(I argc,t_atom *argv)
+V pyobj::m_set(I argc,const t_atom *argv)
{
PY_LOCK
@@ -279,7 +279,7 @@ V pyobj::Reload()
}
-V pyobj::work(const t_symbol *s,I argc,t_atom *argv)
+V pyobj::work(const t_symbol *s,I argc,const t_atom *argv)
{
AtomList *rargs = NULL;
@@ -311,7 +311,7 @@ V pyobj::work(const t_symbol *s,I argc,t_atom *argv)
}
}
-V pyobj::callwork(const t_symbol *s,I argc,t_atom *argv)
+V pyobj::callwork(const t_symbol *s,I argc,const t_atom *argv)
{
if(detach) {
if(shouldexit)
diff --git a/externals/grill/py/source/pyext.cpp b/externals/grill/py/source/pyext.cpp
index 8e971873..4df12c37 100644
--- a/externals/grill/py/source/pyext.cpp
+++ b/externals/grill/py/source/pyext.cpp
@@ -36,7 +36,7 @@ I pyext::pyextref = 0;
PyObject *pyext::class_obj = NULL;
PyObject *pyext::class_dict = NULL;
-pyext::pyext(I argc,t_atom *argv):
+pyext::pyext(I argc,const t_atom *argv):
pyobj(NULL),pythr(NULL),
inlets(0),outlets(0),
methname(NULL)
@@ -274,7 +274,7 @@ V pyext::m_reload()
PY_UNLOCK
}
-V pyext::m_reload_(I argc,t_atom *argv)
+V pyext::m_reload_(I argc,const t_atom *argv)
{
args(argc,argv);
m_reload();
@@ -336,7 +336,7 @@ V pyext::m_help()
post("");
}
-PyObject *pyext::call(const C *meth,I inlet,const t_symbol *s,I argc,t_atom *argv)
+PyObject *pyext::call(const C *meth,I inlet,const t_symbol *s,I argc,const t_atom *argv)
{
PyObject *ret = NULL;
@@ -351,7 +351,7 @@ PyObject *pyext::call(const C *meth,I inlet,const t_symbol *s,I argc,t_atom *arg
else {
ret = PyEval_CallObject(pmeth, pargs);
if (ret == NULL) // function not found resp. arguments not matching
-#ifdef _DEBUG
+#if 1 //def _DEBUG
PyErr_Print();
#else
PyErr_Clear();
@@ -384,7 +384,7 @@ V pyext::work_wrapper(V *data)
--thrcount;
}
-BL pyext::callwork(I n,const t_symbol *s,I argc,t_atom *argv)
+BL pyext::callwork(I n,const t_symbol *s,I argc,const t_atom *argv)
{
if(detach) {
if(shouldexit) {
@@ -401,7 +401,7 @@ BL pyext::callwork(I n,const t_symbol *s,I argc,t_atom *argv)
return work(n,s,argc,argv);
}
-BL pyext::work(I n,const t_symbol *s,I argc,t_atom *argv)
+BL pyext::work(I n,const t_symbol *s,I argc,const t_atom *argv)
{
BL retv = false;
diff --git a/externals/grill/py/source/pyext.h b/externals/grill/py/source/pyext.h
index 2aba0e8e..f0baf310 100644
--- a/externals/grill/py/source/pyext.h
+++ b/externals/grill/py/source/pyext.h
@@ -19,7 +19,7 @@ class pyext:
FLEXT_HEADER_S(pyext,py,setup)
public:
- pyext(I argc,t_atom *argv);
+ pyext(I argc,const t_atom *argv);
~pyext();
static PyObject *pyext__doc__(PyObject *,PyObject *args);
@@ -41,10 +41,10 @@ public:
protected:
BL m_method_(I n,const t_symbol *s,I argc,t_atom *argv);
- BL work(I n,const t_symbol *s,I argc,t_atom *argv);
+ BL work(I n,const t_symbol *s,I argc,const t_atom *argv);
V m_reload();
- V m_reload_(I argc,t_atom *argv);
+ V m_reload_(I argc,const t_atom *argv);
V m_doc_();
virtual V m_help();
@@ -87,7 +87,7 @@ private:
// bool cmp(PyObject *s,PyObject *f) const { return self == s && func == f; }
// void init(PyObject *s,char *f) { self = s,func = f,nxt = NULL; }
// bool cmp(PyObject *s,char *f) const { return self == s && func == f; }
- static void px_method(py_proxy *c,const t_symbol *s,int argc,t_atom *argv);
+ static void px_method(py_proxy *c,const t_symbol *s,int argc,const t_atom *argv);
};
static py_proxy *px_head,*px_tail;
@@ -96,16 +96,16 @@ private:
// ---------------------------
- PyObject *call(const C *meth,I inlet,const t_symbol *s,I argc,t_atom *argv);
+ PyObject *call(const C *meth,I inlet,const t_symbol *s,I argc,const t_atom *argv);
V work_wrapper(void *data);
- BL callwork(I n,const t_symbol *s,I argc,t_atom *argv);
+ BL callwork(I n,const t_symbol *s,I argc,const t_atom *argv);
class work_data:
public flext::AtomAnything
{
public:
- work_data(I _n,const t_symbol *_s,I _argc,t_atom *_argv): n(_n),AtomAnything(_s,_argc,_argv) {}
+ work_data(I _n,const t_symbol *_s,I _argc,const t_atom *_argv): n(_n),AtomAnything(_s,_argc,_argv) {}
I n;
};