From 6138980e885884ef96b726f695fb038e2b939935 Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Wed, 19 Jan 2005 04:58:36 +0000 Subject: - 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 svn path=/trunk/; revision=2523 --- externals/grill/py/build/gnumake-lnx-gcc.inc | 1 + externals/grill/py/build/gnumake-mac-gcc.inc | 5 ++- externals/grill/py/build/nmake-win-msvc.inc | 1 + externals/grill/py/pd/attr-1.pd | 27 +++++++------- externals/grill/py/pd/script-1.pd | 9 +++-- externals/grill/py/pd/sendrecv-1.pd | 10 +++--- externals/grill/py/pd/sendrecv-2.pd | 6 ++-- externals/grill/py/pd/sendrecv-3.pd | 8 ++--- externals/grill/py/pd/simple-1.pd | 6 ++-- externals/grill/py/pd/simple-2.pd | 6 ++-- externals/grill/py/pd/simple-3.pd | 6 ++-- externals/grill/py/pd/tcltk.pd | 14 ++++---- externals/grill/py/py.vcproj | 26 +++++++------- externals/grill/py/scripts/pak.py | 6 ++-- externals/grill/py/scripts/script.py | 5 +-- externals/grill/py/scripts/sendrecv.py | 8 ++--- externals/grill/py/scripts/simple.py | 20 +++++------ externals/grill/py/source/pyargs.cpp | 6 ++-- externals/grill/py/source/pyprefix.h | 4 +-- externals/grill/py/source/pysymbol.cpp | 1 + externals/grill/py/source/pysymbol.h | 53 +++++++++++++++++++++++----- 21 files changed, 137 insertions(+), 91 deletions(-) diff --git a/externals/grill/py/build/gnumake-lnx-gcc.inc b/externals/grill/py/build/gnumake-lnx-gcc.inc index f12ec62e..bdb375f1 100644 --- a/externals/grill/py/build/gnumake-lnx-gcc.inc +++ b/externals/grill/py/build/gnumake-lnx-gcc.inc @@ -1,2 +1,3 @@ +DEFS += -DPY_EXPORTS INCPATH += -I$(PYTHONPREFIX)/include/python$(PYTHONVERSION) LIBS += -lpython$(PYTHONVERSION) diff --git a/externals/grill/py/build/gnumake-mac-gcc.inc b/externals/grill/py/build/gnumake-mac-gcc.inc index 0e510dec..16e9df6f 100644 --- a/externals/grill/py/build/gnumake-mac-gcc.inc +++ b/externals/grill/py/build/gnumake-mac-gcc.inc @@ -1,4 +1,3 @@ -# - -LIBS += -framework Python +DEFS += -DPY_EXPORTS +LIBS += -framework Python diff --git a/externals/grill/py/build/nmake-win-msvc.inc b/externals/grill/py/build/nmake-win-msvc.inc index 8748d223..373f98a7 100644 --- a/externals/grill/py/build/nmake-win-msvc.inc +++ b/externals/grill/py/build/nmake-win-msvc.inc @@ -1,2 +1,3 @@ +DEFS = $(DEFS) /DPY_EXPORTS INCPATH=/I$(PYTHONPATH)\include LIBPATH=/LIBPATH:$(PYTHONPATH)\libs diff --git a/externals/grill/py/pd/attr-1.pd b/externals/grill/py/pd/attr-1.pd index bf797c70..56875379 100644 --- a/externals/grill/py/pd/attr-1.pd +++ b/externals/grill/py/pd/attr-1.pd @@ -1,28 +1,30 @@ -#N canvas 114 127 693 451 12; +#N canvas 114 127 697 455 12; #X obj 224 397 pyext simple ex3; #X obj 392 398 print A; -#X msg 252 207 get tmp; -#X msg 369 237 get _inlets; -#X msg 253 231 set tmp 3; -#X msg 368 261 set _inlets 4; +#X msg 362 247 get tmp; +#X msg 396 320 get _inlets; +#X msg 395 344 set _inlets 4; #X msg 18 206 dir; #X msg 15 312 getattributes; #X msg 15 336 getmethods; #X msg 18 234 dir+; #X text 15 75 This demonstrates the usage of attributes. See the simple.py file.; -#X text 252 188 access a class variable; -#X text 368 218 try to get/set internal stuff; -#X text 479 261 (NOT allowed!); -#X text 16 288 get attributes and methods; +#X text 260 212 access a class variable; +#X text 395 301 try to get/set internal stuff; +#X text 506 347 (NOT allowed!); +#X text 14 288 get attributes and methods; #X text 51 205 Python module dict; #X text 59 235 Python class dict; #X text 17 128 All attribute-related methods dump eventual output to the attribute outlet (which is the right-most one); #X obj 16 13 cnv 15 650 40 empty empty py/pyext 10 22 0 24 -260818 -1 0; -#X text 235 32 http://www.parasitaere-kapazitaeten.net; -#X text 235 16 Python script objects \, (C)2003-2004 Thomas Grill; +#X text 235 16 Python script objects \, (C)2003-2005 Thomas Grill; +#X text 235 32 http://grrrr.org/ext; +#X msg 260 248 set tmp \$1; +#X obj 259 230 nbx 5 14 -1e+037 1e+037 0 0 empty empty empty 0 -6 0 +10 -262144 -1 -1 0 256; #X connect 0 1 1 0; #X connect 2 0 0 0; #X connect 3 0 0 0; @@ -31,4 +33,5 @@ the attribute outlet (which is the right-most one); #X connect 6 0 0 0; #X connect 7 0 0 0; #X connect 8 0 0 0; -#X connect 9 0 0 0; +#X connect 20 0 0 0; +#X connect 21 0 20 0; diff --git a/externals/grill/py/pd/script-1.pd b/externals/grill/py/pd/script-1.pd index 39e3b27b..b748857d 100644 --- a/externals/grill/py/pd/script-1.pd +++ b/externals/grill/py/pd/script-1.pd @@ -1,4 +1,4 @@ -#N canvas 297 17 684 526 12; +#N canvas 297 17 688 530 12; #X obj 39 278 print; #X obj 345 251 print; #X msg 499 149 freakhole; @@ -33,8 +33,10 @@ file.; #X msg 58 160 dir+; #X obj 16 13 cnv 15 630 40 empty empty py/pyext 10 22 0 24 -260818 -1 0; -#X text 235 32 http://www.parasitaere-kapazitaeten.net; -#X text 235 16 Python script objects \, (C)2003-2004 Thomas Grill; +#X text 235 16 Python script objects \, (C)2003-2005 Thomas Grill; +#X text 235 32 http://grrrr.org/ext; +#X msg 509 178 a b c; +#X text 556 181 too many args; #X connect 2 0 25 1; #X connect 3 0 21 1; #X connect 4 0 21 1; @@ -56,3 +58,4 @@ file.; #X connect 25 0 1 0; #X connect 26 0 21 0; #X connect 28 0 21 0; +#X connect 32 0 25 1; diff --git a/externals/grill/py/pd/sendrecv-1.pd b/externals/grill/py/pd/sendrecv-1.pd index ca399705..02ac052a 100644 --- a/externals/grill/py/pd/sendrecv-1.pd +++ b/externals/grill/py/pd/sendrecv-1.pd @@ -1,4 +1,4 @@ -#N canvas 145 126 650 325 12; +#N canvas 145 126 654 329 12; #X msg 125 81 reload mi ma; #X floatatom 48 238 5 0 0 0 - - -; #X floatatom 297 239 5 0 0 0 - - -; @@ -17,10 +17,10 @@ #X text 292 219 or here; #X obj 16 13 cnv 15 600 40 empty empty py/pyext 10 22 0 24 -260818 -1 0; -#X text 213 32 http://www.parasitaere-kapazitaeten.net; -#X text 213 16 Python script objects \, (C)2003-2004 Thomas Grill; #X msg 202 128 bind; #X msg 249 129 unbind; +#X text 213 16 Python script objects \, (C)2003-2005 Thomas Grill; +#X text 213 32 http://grrrr.org/ext; #X connect 0 0 13 0; #X connect 1 0 7 0; #X connect 2 0 3 0; @@ -29,5 +29,5 @@ #X connect 10 0 13 0; #X connect 11 0 13 0; #X connect 12 0 13 0; -#X connect 19 0 13 1; -#X connect 20 0 13 1; +#X connect 17 0 13 1; +#X connect 18 0 13 1; diff --git a/externals/grill/py/pd/sendrecv-2.pd b/externals/grill/py/pd/sendrecv-2.pd index a257d5e8..77a6a466 100644 --- a/externals/grill/py/pd/sendrecv-2.pd +++ b/externals/grill/py/pd/sendrecv-2.pd @@ -1,4 +1,4 @@ -#N canvas 133 322 643 185 12; +#N canvas 133 322 647 189 12; #X obj 152 98 pyext sendrecv ex2 huha; #X floatatom 152 128 5 0 0 0 - - -; #X floatatom 33 96 5 0 0 0 - - -; @@ -6,7 +6,7 @@ #X text 20 77 scroll here; #X obj 16 13 cnv 15 600 40 empty empty py/pyext 10 22 0 24 -260818 -1 0; -#X text 213 32 http://www.parasitaere-kapazitaeten.net; -#X text 213 16 Python script objects \, (C)2003-2004 Thomas Grill; +#X text 213 16 Python script objects \, (C)2003-2005 Thomas Grill; +#X text 213 32 http://grrrr.org/ext; #X connect 0 0 1 0; #X connect 2 0 3 0; diff --git a/externals/grill/py/pd/sendrecv-3.pd b/externals/grill/py/pd/sendrecv-3.pd index 037895fb..f1847f6a 100644 --- a/externals/grill/py/pd/sendrecv-3.pd +++ b/externals/grill/py/pd/sendrecv-3.pd @@ -1,9 +1,9 @@ -#N canvas 294 237 640 319 12; -#X obj 410 265 pyext sendrecv ex3; +#N canvas 294 237 644 323 12; +#X obj 410 265 pyext sendrecv ex3 @detach 1; #X obj 564 262 bng 25 250 50 0 empty ugh empty 0 -6 0 8 -258699 -1 -1; #X obj 16 13 cnv 15 600 40 empty empty py/pyext 10 22 0 24 -260818 -1 0; -#X text 213 32 http://www.parasitaere-kapazitaeten.net; -#X text 213 16 Python script objects \, (C)2003-2004 Thomas Grill; +#X text 213 16 Python script objects \, (C)2003-2005 Thomas Grill; +#X text 213 32 http://grrrr.org/ext; #X connect 1 0 0 1; diff --git a/externals/grill/py/pd/simple-1.pd b/externals/grill/py/pd/simple-1.pd index f4b10cae..d34d43b5 100644 --- a/externals/grill/py/pd/simple-1.pd +++ b/externals/grill/py/pd/simple-1.pd @@ -1,4 +1,4 @@ -#N canvas 156 192 662 389 12; +#N canvas 156 192 670 397 12; #X obj 53 123 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X floatatom 52 155 5 0 0 0 - - -; @@ -23,8 +23,8 @@ file.; #X msg 106 325 doc+; #X obj 16 13 cnv 15 600 40 empty empty py/pyext 10 22 0 24 -260818 -1 0; -#X text 213 32 http://www.parasitaere-kapazitaeten.net; -#X text 213 16 Python script objects \, (C)2003-2004 Thomas Grill; +#X text 213 32 http://grrrr.org/ext; +#X text 213 16 Python script objects \, (C)2003-2005 Thomas Grill; #X connect 0 0 9 1; #X connect 1 0 9 1; #X connect 3 0 9 1; diff --git a/externals/grill/py/pd/simple-2.pd b/externals/grill/py/pd/simple-2.pd index 31680d87..1845b032 100644 --- a/externals/grill/py/pd/simple-2.pd +++ b/externals/grill/py/pd/simple-2.pd @@ -1,4 +1,4 @@ -#N canvas 95 223 650 390 12; +#N canvas 95 223 654 394 12; #X floatatom 202 113 5 0 0 0 - - -; #X text 338 286 watch the console output!; #X msg 20 115 help; @@ -21,8 +21,8 @@ file.; so _anything_ is called!; #X obj 16 13 cnv 15 600 40 empty empty py/pyext 10 22 0 24 -260818 -1 0; -#X text 213 32 http://www.parasitaere-kapazitaeten.net; -#X text 213 16 Python script objects \, (C)2003-2004 Thomas Grill; +#X text 213 16 Python script objects \, (C)2003-2005 Thomas Grill; +#X text 213 32 http://grrrr.org/ext; #X connect 0 0 8 1; #X connect 2 0 8 0; #X connect 4 0 8 0; diff --git a/externals/grill/py/pd/simple-3.pd b/externals/grill/py/pd/simple-3.pd index 9cdb3f1b..ceebbcf3 100644 --- a/externals/grill/py/pd/simple-3.pd +++ b/externals/grill/py/pd/simple-3.pd @@ -1,4 +1,4 @@ -#N canvas 136 275 649 361 12; +#N canvas 136 275 653 365 12; #X msg 73 266 help; #X text 17 80 This demonstrates message handling. See the simple.py file.; @@ -17,8 +17,8 @@ file.; #X text 410 140 sets argument; #X obj 16 13 cnv 15 600 40 empty empty py/pyext 10 22 0 24 -260818 -1 0; -#X text 213 32 http://www.parasitaere-kapazitaeten.net; -#X text 213 16 Python script objects \, (C)2003-2004 Thomas Grill; +#X text 213 16 Python script objects \, (C)2003-2005 Thomas Grill; +#X text 213 32 http://grrrr.org/ext; #X connect 0 0 7 0; #X connect 2 0 7 0; #X connect 3 0 7 0; diff --git a/externals/grill/py/pd/tcltk.pd b/externals/grill/py/pd/tcltk.pd index c1c3b246..368544e6 100644 --- a/externals/grill/py/pd/tcltk.pd +++ b/externals/grill/py/pd/tcltk.pd @@ -1,9 +1,7 @@ -#N canvas 156 192 610 329 12; +#N canvas 156 192 614 333 12; #X obj 328 118 bng 25 250 50 0 empty empty empty 0 -6 0 8 -258699 -1 -1; #X msg 94 128 help; -#X text 16 15 py/pyext - Python script objects \, (C)2002 Thomas Grill -; #X msg 139 127 doc; #X text 14 49 This demonstrates a tcl/tk dialog. See the tcltk.py file. ; @@ -12,7 +10,9 @@ notice clicks. This Tk window is NOT called over a net socket \, like PD is; #X obj 206 169 pyext tcltk myapp; #X obj 206 200 print tcltk; -#X connect 0 0 6 1; -#X connect 1 0 6 0; -#X connect 3 0 6 0; -#X connect 6 0 7 0; +#X text 16 15 py/pyext - Python script objects \, (C)2002-2005 Thomas +Grill; +#X connect 0 0 5 1; +#X connect 1 0 5 0; +#X connect 2 0 5 0; +#X connect 5 0 6 0; diff --git a/externals/grill/py/py.vcproj b/externals/grill/py/py.vcproj index 38bfb17d..50640b5b 100644 --- a/externals/grill/py/py.vcproj +++ b/externals/grill/py/py.vcproj @@ -22,7 +22,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="c:\programme\audio\pd\src;f:\prog\max\flext\source;C:\Programme\prog\Python23\include" - PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FLEXT_SYS=2" + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;PY_EXPORTS;FLEXT_SYS=2" BasicRuntimeChecks="3" RuntimeLibrary="5" RuntimeTypeInfo="TRUE" @@ -86,7 +86,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories=""c:\data\prog\pd\pd-cvs\src";c:\data\pdmax\flext\source;"C:\data\prog\packs\Python-2.4\include";"C:\data\prog\packs\Python-2.4\PC"" - PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FLEXT_SYS=2;FLEXT_THREADS" + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;PY_EXPORTS;FLEXT_SYS=2;FLEXT_THREADS" BasicRuntimeChecks="3" RuntimeLibrary="1" RuntimeTypeInfo="TRUE" @@ -152,7 +152,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="c:\programme\audio\pd\src;c:\data\pdmax\flext\source;C:\Programme\prog\Python24\include" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FLEXT_SYS=2;FLEXT_THREADS" + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PY_EXPORTS;FLEXT_SYS=2;FLEXT_THREADS" StringPooling="TRUE" RuntimeLibrary="0" EnableFunctionLevelLinking="TRUE" @@ -217,7 +217,7 @@ Optimization="2" InlineFunctionExpansion="1" AdditionalIncludeDirectories="c:\programme\audio\pd\src;f:\prog\max\flext\source;C:\Programme\prog\Python23\include" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FLEXT_SYS=2" + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PY_EXPORTS;FLEXT_SYS=2" StringPooling="TRUE" RuntimeLibrary="4" EnableFunctionLevelLinking="TRUE" @@ -277,8 +277,8 @@ diff --git a/externals/grill/py/source/pysymbol.cpp b/externals/grill/py/source/pysymbol.cpp index 176f9895..189d6a6f 100644 --- a/externals/grill/py/source/pysymbol.cpp +++ b/externals/grill/py/source/pysymbol.cpp @@ -8,6 +8,7 @@ WARRANTIES, see the file, "license.txt," in this distribution. */ +#include "pyprefix.h" #include "pysymbol.h" inline pySymbol *symbol_newsym(const t_symbol *sym) diff --git a/externals/grill/py/source/pysymbol.h b/externals/grill/py/source/pysymbol.h index bf06437d..c6e057d4 100644 --- a/externals/grill/py/source/pysymbol.h +++ b/externals/grill/py/source/pysymbol.h @@ -8,7 +8,31 @@ WARRANTIES, see the file, "license.txt," in this distribution. */ -#include "pyprefix.h" +#ifndef __PYSYMBOL_H +#define __PYSYMBOL_H + +#include + +#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 500) +#error You need at least flext version 0.5.0 +#endif + +#if FLEXT_OS == FLEXT_OS_MAC +#include +#else +#include +#endif + + +#ifdef _MSC_VER + #ifdef PY_EXPORTS + #define PY_EXPORT __declspec(dllexport) + #else + #define PY_EXPORT __declspec(dllimport) + #endif +#else + #define PY_EXPORT +#endif typedef struct { PyObject_HEAD @@ -16,21 +40,31 @@ typedef struct { const t_symbol *sym; } pySymbol; -extern PyTypeObject pySymbol_Type; +PY_EXPORT extern PyTypeObject pySymbol_Type; -extern pySymbol *pySymbol__; -extern pySymbol *pySymbol_bang; -extern pySymbol *pySymbol_list; -extern pySymbol *pySymbol_symbol; -extern pySymbol *pySymbol_float; -extern pySymbol *pySymbol_int; +PY_EXPORT extern pySymbol *pySymbol__; +PY_EXPORT extern pySymbol *pySymbol_bang; +PY_EXPORT extern pySymbol *pySymbol_list; +PY_EXPORT extern pySymbol *pySymbol_symbol; +PY_EXPORT extern pySymbol *pySymbol_float; +PY_EXPORT extern pySymbol *pySymbol_int; #define pySymbol_Check(op) PyObject_TypeCheck(op, &pySymbol_Type) #define pySymbol_CheckExact(op) ((op)->ob_type == &PySymbol_Type) -PyObject *pySymbol_FromSymbol(const t_symbol *sym); +PY_EXPORT PyObject *pySymbol_FromSymbol(const t_symbol *sym); + +inline PyObject *pySymbol_FromString(const char *str) +{ + return pySymbol_FromSymbol(flext::MakeSymbol(str)); +} + +inline PyObject *pySymbol_FromString(PyObject *str) +{ + return pySymbol_FromSymbol(flext::MakeSymbol(PyString_AsString(str))); +} inline const t_symbol *pySymbol_AS_SYMBOL(PyObject *op) { @@ -55,3 +89,4 @@ inline const t_symbol *pyObject_AsSymbol(PyObject *op) return pySymbol_AsSymbol(op); } +#endif -- cgit v1.2.1