From c6620995f41c40560fee52e12b8629244d6d793e Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Mon, 25 Nov 2002 22:37:04 +0000 Subject: "" svn path=/trunk/; revision=244 --- externals/grill/flext/flext.mpw | 78 ----------------- externals/grill/flext/source/flatom_pr.cpp | 97 +++++++++++++++++++++ externals/grill/flext/tutorial/build-pd-darwin.sh | 10 +++ .../grill/flext/tutorial/config-pd-darwin.txt | 22 +++++ externals/grill/flext/tutorial/makefile.pd-darwin | 67 ++++++++++++++ externals/grill/flext/tutorial/maxmsp/ex-attr1 | Bin 0 -> 1050 bytes externals/grill/flext/tutorial/maxmsp/ex-attr2 | Bin 0 -> 1384 bytes externals/grill/flext/tutorial/maxmsp/ex-lib1 | Bin 0 -> 1440 bytes externals/grill/flext/tutorial/pd/ex-attr1.pd | 34 ++++++++ externals/grill/flext/tutorial/pd/ex-attr2.pd | 49 +++++++++++ externals/grill/flext/tutorial/pd/ex-lib1.pd | 51 +++++++++++ 11 files changed, 330 insertions(+), 78 deletions(-) delete mode 100644 externals/grill/flext/flext.mpw create mode 100644 externals/grill/flext/source/flatom_pr.cpp create mode 100644 externals/grill/flext/tutorial/build-pd-darwin.sh create mode 100644 externals/grill/flext/tutorial/config-pd-darwin.txt create mode 100644 externals/grill/flext/tutorial/makefile.pd-darwin create mode 100755 externals/grill/flext/tutorial/maxmsp/ex-attr1 create mode 100755 externals/grill/flext/tutorial/maxmsp/ex-attr2 create mode 100755 externals/grill/flext/tutorial/maxmsp/ex-lib1 create mode 100644 externals/grill/flext/tutorial/pd/ex-attr1.pd create mode 100644 externals/grill/flext/tutorial/pd/ex-attr2.pd create mode 100644 externals/grill/flext/tutorial/pd/ex-lib1.pd (limited to 'externals/grill') diff --git a/externals/grill/flext/flext.mpw b/externals/grill/flext/flext.mpw deleted file mode 100644 index a287b220..00000000 --- a/externals/grill/flext/flext.mpw +++ /dev/null @@ -1,78 +0,0 @@ -# flext - C++ layer for Max/MSP and pd (pure data) externals -# Copyright (c) 2001,2002 Thomas Grill (xovo@gmx.net) -# -# Makefile for Apple MPW-PR -# -# usage: make -f flext.mpw -# -# --------------------------------------------- - -MAKEFILE = flext.mpw -¥MondoBuild¥ = {MAKEFILE} # Make blank to avoid rebuilds when makefile is modified - -Name = flext - -ObjDir = :MPW: -MaxSDK = Daten:Prog Stuff:Max/MSP SDK:SDK Examples -Includes = -i :,"{MaxSDK}:Max Includes","{MaxSDK}:MSP Includes" -Defines = -d MAXMSP - -Sym-PPC = -sym off -Flags = -bool on -enum int -includes unix -opt speed,unroll,unswitch -WarnOff = -w 35 # arg not used - -PPCCPlusOptions = {Includes} {Sym-PPC} {Defines} {Flags} {WarnOff} - - -### Source Files ### - -Headers = flstdc.h flbase.h fldefs.h flext.h flclass.h fldsp.h flthr.h flmspbuffer.h flinternal.h -SrcFiles = flbase.cpp flbuf.cpp flext.cpp fllib.cpp fldsp.cpp flatom.cpp flsetup.cpp flthr.cpp flutil.cpp flxlet.cpp - -SrcDir = :source: - -### Object Files ### - -ObjFiles-PPC = ¶ - "{ObjDir}flbase.cpp.x" ¶ - "{ObjDir}flbuf.cpp.x" ¶ - "{ObjDir}flext.cpp.x" ¶ - "{ObjDir}fllib.cpp.x" ¶ - "{ObjDir}fldsp.cpp.x" ¶ - "{ObjDir}flatom.cpp.x" ¶ - "{ObjDir}flsetup.cpp.x" ¶ - "{ObjDir}flthr.cpp.x" ¶ - "{ObjDir}flutil.cpp.x" ¶ - "{ObjDir}flxlet.cpp.x" - -### Libraries ### - -LibFiles-PPC = - - -### Default Rules ### - -{ObjDir} Ä {SrcDir} - -.cpp.x Ä .cpp {¥MondoBuild¥} {Headers} - {PPCCPlus} {depDir}{default}.cpp -o {targDir}{default}.cpp.x {PPCCPlusOptions} - - -### Build Rules ### - -all Ä Folder {ObjDir}{Name}.o - -Folder Ä - if !`Exists {ObjDir}` ; NewFolder {ObjDir} ; end - -{ObjDir}{Name}.o ÄÄ {ObjFiles-PPC} {LibFiles-PPC} - PPCLink ¶ - -o {Targ} ¶ - {Deps} ¶ - {Sym-PPC} ¶ - -mf -d ¶ - -t 'XCOF' ¶ - -c 'MPS ' ¶ - -xm l - - diff --git a/externals/grill/flext/source/flatom_pr.cpp b/externals/grill/flext/source/flatom_pr.cpp new file mode 100644 index 00000000..808f0543 --- /dev/null +++ b/externals/grill/flext/source/flatom_pr.cpp @@ -0,0 +1,97 @@ +/* + +flext - C++ layer for Max/MSP and pd (pure data) externals + +Copyright (c) 2001,2002 Thomas Grill (xovo@gmx.net) +For information on usage and redistribution, and for a DISCLAIMER OF ALL +WARRANTIES, see the file, "license.txt," in this distribution. + +*/ + +/*! \file flatom_pr.cpp + \brief Definitions for printing and scanning the t_atom type. +*/ + +#include "flext.h" +#include +#include +#include +#include + +#ifdef __MWERKS__ +#define STD std +#else +#define STD +#endif + +void flext::PrintAtom(const t_atom &a,char *buf) +{ + switch(a.a_type) { + case A_NULL: + break; + case A_FLOAT: +#ifdef PD + if(a.a_w.w_float == (int)a.a_w.w_float) + STD::sprintf(buf,"%i",(int)GetFloat(a)); + else +#endif + STD::sprintf(buf,"%f",GetFloat(a)); + break; +#ifdef MAXMSP + case A_LONG: + STD::sprintf(buf,"%i",GetInt(a)); + break; +#endif +#ifdef PD + case A_POINTER: + STD::sprintf(buf,"%x",GetPointer(a)); + break; +#endif + case A_SYMBOL: + strcpy(buf,GetString(a)); + break; +#ifdef _DEBUG + default: + ERRINTERNAL(); +#endif + } +} + +bool flext::ScanAtom(t_atom &a,const char *buf) +{ + // skip whitespace + while(*buf && isspace(*buf)) ++buf; + if(!*buf) return false; + + char tmp[1024]; + strcpy(tmp,buf); + char *c = tmp; + + // check for word type (s = 0,1,2 ... int,float,symbol) + int s = 0; + for(; *c && !isspace(*c); ++c) { + if(!isdigit(*c)) + s = (*c != '.' || s == 1)?2:1; + } + + switch(s) { + case 0: // integer +#ifdef MAXMSP + SetInt(a,atol(tmp)); + break; +#endif + case 1: // float + SetFloat(a,(float)atof(tmp)); + break; + default: { // anything else is a symbol + char t = *c; *c = 0; + SetString(a,tmp); + *c = t; + break; + } + } + + return true; +} + + diff --git a/externals/grill/flext/tutorial/build-pd-darwin.sh b/externals/grill/flext/tutorial/build-pd-darwin.sh new file mode 100644 index 00000000..bd31780c --- /dev/null +++ b/externals/grill/flext/tutorial/build-pd-darwin.sh @@ -0,0 +1,10 @@ +#!/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/flext/tutorial/config-pd-darwin.txt b/externals/grill/flext/tutorial/config-pd-darwin.txt new file mode 100644 index 00000000..286e9333 --- /dev/null +++ b/externals/grill/flext/tutorial/config-pd-darwin.txt @@ -0,0 +1,22 @@ +# flext - C++ layer for Max/MSP and pd (pure data) externals +# tutorial examples +# Copyright (c) 2001,2002 Thomas Grill (xovo@gmx.net) +# + +# where are the PD header files? +# if it is a system include path (like /usr/local/include) +# you should leave it blank (as e.g. g++ 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 + +# where should the examples be built? (relative path) +OUTPATH=./pd-darwin + +# where should the examples be installed? +# (leave blank to omit installation) +INSTPATH=${FLEXTPATH}/tutorial diff --git a/externals/grill/flext/tutorial/makefile.pd-darwin b/externals/grill/flext/tutorial/makefile.pd-darwin new file mode 100644 index 00000000..1f3743ef --- /dev/null +++ b/externals/grill/flext/tutorial/makefile.pd-darwin @@ -0,0 +1,67 @@ +# flext tutorial examples +# +# Makefile for gcc @ darwin (OSX) +# +# usage: make -f makefile.pd-darwin +# +# ----------------------------------------------------- + +include config-pd-darwin.txt + +FLEXTLIB=$(FLEXTPATH)/flext_t.a # take threaded library for all + + +# compiler+linker stuff ### EDIT! ### +INCLUDES=$(PDPATH) +LIBPATH= +FLAGS=-DPD -Dunix -DMACOSX -DFLEXT_THREADS -Wno-unused -Wno-parentheses -Wno-switch -Wstrict-prototypes # -maltivec +CFLAGS=-O6 +LIBS=m +LDFLAGS=-bundle -bundle_loader $(PD) + +# the rest can stay untouched +# ---------------------------------------------- + +# all the source files from the package + +EXAMPLES=simple1 simple2 simple3 adv1 attr1 attr2 signal1~ signal2~ lib1 thread1 thread2 # attr2 + + +TARGETS=$(patsubst %,$(OUTPATH)/%.pd_darwin,$(EXAMPLES)) + +# default target +all: $(OUTPATH) $(TARGETS) + + +$(OUTPATH)/%~.pd_darwin: $(OUTPATH)/%.pd_darwin + mv $^ $@ + +$(SRCS): $(HDRS) + touch $@ + +$(OUTPATH): + mkdir $(OUTPATH) + +$(OUTPATH)/%.o : %/main.cpp + $(CXX) -c $(CFLAGS) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(FLEXTPATH)) $< -o $@ + +$(OUTPATH)/%.pd_darwin : $(OUTPATH)/%.o $(FLEXTLIB) + $(CXX) $(LDFLAGS) $(patsubst %,-L%,$(LIBPATH)) $^ $(patsubst %,-l%,$(LIBS)) -o $@ + chmod 755 $@ + + +.PHONY: clean +clean: + rm -f $(OUTPATH)/*.o $(TARGETS) + +ifdef INSTPATH +$(INSTPATH): + -mkdir $(INSTPATH) + +install:: $(INSTPATH) +endif + +install:: $(patsubst %,$(OUTPATH)/%.pd_darwin,$(EXAMPLES)) + cp $^ $(INSTPATH) + + diff --git a/externals/grill/flext/tutorial/maxmsp/ex-attr1 b/externals/grill/flext/tutorial/maxmsp/ex-attr1 new file mode 100755 index 00000000..5dc46f10 Binary files /dev/null and b/externals/grill/flext/tutorial/maxmsp/ex-attr1 differ diff --git a/externals/grill/flext/tutorial/maxmsp/ex-attr2 b/externals/grill/flext/tutorial/maxmsp/ex-attr2 new file mode 100755 index 00000000..39256fcb Binary files /dev/null and b/externals/grill/flext/tutorial/maxmsp/ex-attr2 differ diff --git a/externals/grill/flext/tutorial/maxmsp/ex-lib1 b/externals/grill/flext/tutorial/maxmsp/ex-lib1 new file mode 100755 index 00000000..26f65f2b Binary files /dev/null and b/externals/grill/flext/tutorial/maxmsp/ex-lib1 differ diff --git a/externals/grill/flext/tutorial/pd/ex-attr1.pd b/externals/grill/flext/tutorial/pd/ex-attr1.pd new file mode 100644 index 00000000..97bfad84 --- /dev/null +++ b/externals/grill/flext/tutorial/pd/ex-attr1.pd @@ -0,0 +1,34 @@ +#N canvas 70 150 690 461 12; +#X msg 160 85 help; +#X obj 59 321 attr1 @arg 3; +#X text 114 298 attribute as a creation arg; +#X msg 160 123 getattributes; +#X text 167 344 there is one additional outlet; +#X text 167 359 for all attribute-enabled objects; +#X obj 150 392 print; +#X msg 160 166 getarg; +#X text 12 117 trigger output; +#X msg 160 228 arg \$1; +#X text 230 216 set attribute "arg"; +#X text 295 123 query object attributes (watch console); +#X text 228 167 query attribute "arg" (watch console); +#X obj 16 8 cnv 15 550 40 empty empty attr1 10 22 32 24 -260818 -1 +0; +#X text 175 8 flext tutorial \, (C)2002 Thomas Grill; +#X text 175 28 http://www.parasitaere-kapazitaeten.net; +#X text 206 85 get some "help"; +#X text 26 413 result; +#X obj 23 139 nbx 4 16 -999 999 0 0 empty empty empty 0 -6 32 12 -261681 +-1 -1 49 256; +#X obj 29 395 nbx 7 16 -1e+37 1e+37 0 0 empty empty empty 0 -6 32 12 +-228992 -1 -1 52 256; +#X obj 161 206 nbx 4 16 -999 999 0 0 empty empty empty 0 -6 32 12 -261681 +-1 -1 0 256; +#X connect 0 0 1 0; +#X connect 1 0 19 0; +#X connect 1 1 6 0; +#X connect 3 0 1 0; +#X connect 7 0 1 0; +#X connect 9 0 1 0; +#X connect 18 0 1 0; +#X connect 20 0 9 0; diff --git a/externals/grill/flext/tutorial/pd/ex-attr2.pd b/externals/grill/flext/tutorial/pd/ex-attr2.pd new file mode 100644 index 00000000..4ac89a0e --- /dev/null +++ b/externals/grill/flext/tutorial/pd/ex-attr2.pd @@ -0,0 +1,49 @@ +#N canvas 364 29 605 442 12; +#X msg 21 84 help; +#X msg 23 119 getattributes; +#X text 265 350 there is one additional outlet; +#X text 265 365 for all attribute-enabled objects; +#X obj 247 389 print; +#X msg 23 162 getarg; +#X text 67 84 get some help; +#X text 15 314 trigger output; +#X msg 23 222 arg \$1; +#X text 160 118 query object attributes (watch console); +#X msg 96 162 getop; +#X obj 159 330 attr2 @op +; +#X text 255 161 query attributes; +#X text 333 210 set attributes; +#X msg 169 200 op +; +#X msg 168 225 op -; +#X msg 219 200 op *; +#X msg 269 224 op **; +#X msg 269 200 op =; +#X msg 219 224 op /; +#X msg 158 162 getresult; +#X obj 16 8 cnv 15 550 40 empty empty attr2 10 22 32 24 -260818 -1 +0; +#X text 173 8 flext tutorial \, (C)2002 Thomas Grill; +#X text 173 28 http://www.parasitaere-kapazitaeten.net; +#X text 91 391 result; +#X obj 23 336 nbx 4 16 -999 999 0 0 empty empty empty 0 -6 32 12 -261681 +-1 -1 -55 256; +#X obj 23 201 nbx 4 16 -999 999 0 0 empty empty empty 0 -6 96 12 -261681 +-1 -1 1 256; +#X obj 151 391 nbx 7 16 -1e+37 1e+37 0 0 empty empty empty 0 -6 32 +12 -228992 -1 -1 -54 256; +#X connect 0 0 11 0; +#X connect 1 0 11 0; +#X connect 5 0 11 0; +#X connect 8 0 11 0; +#X connect 10 0 11 0; +#X connect 11 0 27 0; +#X connect 11 1 4 0; +#X connect 14 0 11 0; +#X connect 15 0 11 0; +#X connect 16 0 11 0; +#X connect 17 0 11 0; +#X connect 18 0 11 0; +#X connect 19 0 11 0; +#X connect 20 0 11 0; +#X connect 25 0 11 0; +#X connect 26 0 8 0; diff --git a/externals/grill/flext/tutorial/pd/ex-lib1.pd b/externals/grill/flext/tutorial/pd/ex-lib1.pd new file mode 100644 index 00000000..83311593 --- /dev/null +++ b/externals/grill/flext/tutorial/pd/ex-lib1.pd @@ -0,0 +1,51 @@ +#N canvas 120 205 580 295 12; +#X msg 106 125 arg \$1; +#X obj 34 161 lib1.+ @arg 3; +#X text 105 77 set arg; +#X msg 289 124 arg \$1; +#X text 288 78 set arg; +#X msg 476 127 arg \$1; +#X text 475 81 set arg; +#X obj 396 165 lib1.* @arg 2; +#X obj 214 163 lib1.- @arg 7; +#X text 29 76 trigger; +#X text 211 80 trigger; +#X text 395 81 trigger; +#X obj 16 8 cnv 15 550 40 empty empty lib1 10 22 0 24 -260818 -1 0 +; +#X text 173 8 flext tutorial \, (C)2002 Thomas Grill; +#X text 173 28 http://www.parasitaere-kapazitaeten.net; +#X obj 34 100 nbx 4 16 -999 999 0 0 empty empty empty 0 -6 0 12 -261681 +-1 -1 0 256; +#X obj 105 99 nbx 4 16 -999 999 0 0 empty empty empty 0 -6 0 12 -261681 +-1 -1 0 256; +#X obj 216 100 nbx 4 16 -999 999 0 0 empty empty empty 0 -6 0 12 -261681 +-1 -1 0 256; +#X obj 288 102 nbx 4 16 -999 999 0 0 empty empty empty 0 -6 0 12 -261681 +-1 -1 0 256; +#X obj 398 102 nbx 4 16 -999 999 0 0 empty empty empty 0 -6 0 12 -261681 +-1 -1 0 256; +#X obj 476 105 nbx 4 16 -999 999 0 0 empty empty empty 0 -6 0 12 -261681 +-1 -1 0 256; +#X obj 34 194 nbx 7 16 -1e+37 1e+37 0 0 empty empty empty 0 -6 0 12 +-228992 -1 -1 0 256; +#X obj 214 194 nbx 7 16 -1e+37 1e+37 0 0 empty empty empty 0 -6 0 12 +-228992 -1 -1 0 256; +#X obj 396 194 nbx 7 16 -1e+37 1e+37 0 0 empty empty empty 0 -6 0 12 +-228992 -1 -1 0 256; +#X text 26 245 In order to use the objects the library must have been +; +#X text 27 263 loaded at PD startup (with the "-lib lib1" argument) +; +#X connect 0 0 1 0; +#X connect 1 0 21 0; +#X connect 3 0 8 0; +#X connect 5 0 7 0; +#X connect 7 0 23 0; +#X connect 8 0 22 0; +#X connect 15 0 1 0; +#X connect 16 0 0 0; +#X connect 17 0 8 0; +#X connect 18 0 3 0; +#X connect 19 0 7 0; +#X connect 20 0 5 0; -- cgit v1.2.1