aboutsummaryrefslogtreecommitdiff
path: root/strcut
diff options
context:
space:
mode:
authorjasch <j45ch@users.sourceforge.net>2007-07-15 22:10:54 +0000
committerjasch <j45ch@users.sourceforge.net>2007-07-15 22:10:54 +0000
commit0e53ee1a6f430d42b1509c1bad12f59747a47f97 (patch)
treeb8254807b5a8b736346ddd56ba93472d379bee13 /strcut
parentdc75bfe5defab2bad40aa3c90a9d21a608f44cd7 (diff)
This commit was generated by cvs2svn to compensate for changes in r8087,
which included commits to RCS files with non-trunk default branches. svn path=/trunk/externals/jasch_lib/; revision=8088
Diffstat (limited to 'strcut')
-rw-r--r--strcut/makefile92
-rw-r--r--strcut/strcut-help.pd14
-rw-r--r--strcut/strcut.c1
3 files changed, 107 insertions, 0 deletions
diff --git a/strcut/makefile b/strcut/makefile
new file mode 100644
index 0000000..bca7ca9
--- /dev/null
+++ b/strcut/makefile
@@ -0,0 +1,92 @@
+NAME=strcut
+CSYM=strcut
+
+current: pd_darwin
+
+# ----------------------- NT -----------------------
+
+pd_nt: $(NAME).dll
+
+.SUFFIXES: .dll
+
+PDNTCFLAGS = /W3 /WX /DNT /DPD /nologo
+VC="C:\Program Files\Microsoft Visual Studio\Vc98"
+
+PDNTINCLUDE = /I. /I..\..\src /I$(VC)\include
+
+PDNTLDIR = $(VC)\lib
+PDNTLIB = $(PDNTLDIR)\libc.lib \
+ $(PDNTLDIR)\oldnames.lib \
+ $(PDNTLDIR)\kernel32.lib \
+ ..\..\bin\pd.lib
+
+.c.dll:
+ cl $(PDNTCFLAGS) $(PDNTINCLUDE) /c $*.c
+ link /dll /export:$(CSYM)_setup $*.obj $(PDNTLIB)
+
+# ----------------------- IRIX 5.x -----------------------
+
+pd_irix5: $(NAME).pd_irix5
+
+.SUFFIXES: .pd_irix5
+
+SGICFLAGS5 = -o32 -DPD -DUNIX -DIRIX -O2
+
+SGIINCLUDE = -I../../src
+
+.c.pd_irix5:
+ $(CC) $(SGICFLAGS5) $(SGIINCLUDE) -o $*.o -c $*.c
+ ld -elf -shared -rdata_shared -o $*.pd_irix5 $*.o
+ rm $*.o
+
+# ----------------------- IRIX 6.x -----------------------
+
+pd_irix6: $(NAME).pd_irix6
+
+.SUFFIXES: .pd_irix6
+
+SGICFLAGS6 = -n32 -DPD -DUNIX -DIRIX -DN32 -woff 1080,1064,1185 \
+ -OPT:roundoff=3 -OPT:IEEE_arithmetic=3 -OPT:cray_ivdep=true \
+ -Ofast=ip32
+
+.c.pd_irix6:
+ $(CC) $(SGICFLAGS6) $(SGIINCLUDE) -o $*.o -c $*.c
+ ld -n32 -IPA -shared -rdata_shared -o $*.pd_irix6 $*.o
+ rm $*.o
+
+# ----------------------- LINUX i386 -----------------------
+
+pd_linux: $(NAME).pd_linux
+
+.SUFFIXES: .pd_linux
+
+LINUXCFLAGS = -DPD -O2 -funroll-loops -fomit-frame-pointer -fPIC \
+ -Wall -W -Wshadow -Wstrict-prototypes \
+ -Wno-unused -Wno-parentheses -Wno-switch $(CFLAGS)
+
+LINUXINCLUDE = -I../../src
+
+.c.pd_linux:
+ $(CC) $(LINUXCFLAGS) $(LINUXINCLUDE) -o $*.o -c $*.c
+ ld -export_dynamic -shared -o $*.pd_linux $*.o -lc -lm
+ strip --strip-unneeded $*.pd_linux
+ rm -f $*.o
+
+# ----------------------- Mac OSX -----------------------
+
+pd_darwin: $(NAME).pd_darwin
+
+.SUFFIXES: .pd_darwin
+
+DARWINCFLAGS = -DPD -O2 -Wall -W -Wshadow -Wstrict-prototypes \
+ -Wno-unused -Wno-parentheses -Wno-switch
+
+.c.pd_darwin:
+ $(CC) $(DARWINCFLAGS) $(LINUXINCLUDE) -o $*.o -c $*.c
+ $(CC) -bundle -undefined suppress -flat_namespace -o $*.pd_darwin $*.o
+ rm -f $*.o
+
+# ----------------------------------------------------------
+
+clean:
+ rm -f *.o *.pd_* so_locations
diff --git a/strcut/strcut-help.pd b/strcut/strcut-help.pd
new file mode 100644
index 0000000..74e5dc0
--- /dev/null
+++ b/strcut/strcut-help.pd
@@ -0,0 +1,14 @@
+#N canvas 264 113 544 306 10;
+#X obj 305 26 import jasch_lib;
+#X obj 159 207 prepend set;
+#X msg 160 230 alpha/;
+#X floatatom 239 131 5 0 0 0 - - -;
+#X obj 159 163 strcut 3;
+#X msg 181 109 symbol supercalifragilisti;
+#X text 281 130 cut-position;
+#X msg 158 90 symbol alpha/beta;
+#X connect 1 0 2 0;
+#X connect 3 0 4 0;
+#X connect 4 0 1 0;
+#X connect 5 0 4 0;
+#X connect 7 0 4 0;
diff --git a/strcut/strcut.c b/strcut/strcut.c
new file mode 100644
index 0000000..7b30aa0
--- /dev/null
+++ b/strcut/strcut.c
@@ -0,0 +1 @@
+/*__________________________________________________________________________ strcut á strcut terminate string at position n Copyright (C) 2003 jan schacher This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA initial build 20030511 fixed end conditions 20040713 ____________________________________________________________________________*/ #include "m_pd.h" #include <string.h> #define MIN(a,b) ((a)<(b)?(a):(b)) typedef struct strcut { t_object ob; void *s_outlet; long s_numChar; } t_strcut; void *strcut_class; void *strcut_new(t_symbol *s, long argc, t_atom *argv); void strcut_free(t_strcut *x); void strcut_float(t_strcut *x, float f); void strcut_anything(t_strcut *x, t_symbol *s, long argc, t_atom *argv); void strcut_setup(void) { strcut_class = class_new(gensym("strcut"), (t_newmethod)strcut_new, (t_method)strcut_free, sizeof(t_strcut), 0, A_GIMME, 0); class_addfloat(strcut_class, (t_method)strcut_float); class_addsymbol(strcut_class, (t_method)strcut_anything); post(". strcut . jasch . "__DATE__" ",0); } void *strcut_new(t_symbol *s, long argc, t_atom *argv) { short i; t_strcut *x; x = (t_strcut *)pd_new(strcut_class); x->s_outlet = outlet_new(&x->ob, gensym("symbol")); x->s_numChar = 1; for(i=0; i<argc; i++){ if(argv[i].a_type == A_FLOAT){ x->s_numChar = argv[i].a_w.w_float; // post("argument %ld is %f", i, argv[i].a_w.w_float); }else if(argv[i].a_type == A_SYMBOL){ // post("argument %ld is %s", i, argv[i].a_w.w_symbol->s_name); } } return (x); } void strcut_assist(t_strcut *x, void *b, long msg, long arg, char *dst) { if(msg==1) switch(arg){ case 0: strcpy(dst, "string in (symbol) cut pos (int)"); break; } else if(msg==2){ strcpy(dst, "string out"); } } void strcut_anything(t_strcut *x, t_symbol *s, long argc, t_atom *argv) { char *ptr; char local[4096]; strcpy(local, s->s_name); local[MIN((long)strlen(local), x->s_numChar)] = 0; ptr = local; outlet_anything(x->s_outlet, gensym(ptr), 0, 0L); } void strcut_float(t_strcut *x, float f) { x->s_numChar = (long)((f >= 0) ? f : 0); } void strcut_free(t_strcut *x) { // notify_free((t_object *)x); } \ No newline at end of file