diff options
-rw-r--r-- | memchr/makefile | 92 | ||||
-rw-r--r-- | memchr/memchr-help.pd | 22 | ||||
-rw-r--r-- | memchr/memchr.c | 1 | ||||
-rw-r--r-- | memchr/strchr-help.pd | 22 | ||||
-rw-r--r-- | memchr/strchr.c | 1 | ||||
-rw-r--r-- | strchr/makefile | 92 | ||||
-rw-r--r-- | strchr/strchr-help.pd | 22 | ||||
-rw-r--r-- | strchr/strchr.c | 1 | ||||
-rw-r--r-- | strcut/makefile | 92 | ||||
-rw-r--r-- | strcut/strcut-help.pd | 14 | ||||
-rw-r--r-- | strcut/strcut.c | 1 | ||||
-rw-r--r-- | strlen/makefile | 92 | ||||
-rw-r--r-- | strlen/strlen-help.pd | 9 | ||||
-rw-r--r-- | strlen/strlen.c | 1 | ||||
-rw-r--r-- | strtok/makefile | 92 | ||||
-rw-r--r-- | strtok/strtok-help.pd | 16 | ||||
-rw-r--r-- | strtok/strtok.c | 1 |
17 files changed, 571 insertions, 0 deletions
diff --git a/memchr/makefile b/memchr/makefile new file mode 100644 index 0000000..14a56c1 --- /dev/null +++ b/memchr/makefile @@ -0,0 +1,92 @@ +NAME=memchr +CSYM=memchr + +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/memchr/memchr-help.pd b/memchr/memchr-help.pd new file mode 100644 index 0000000..8290b5f --- /dev/null +++ b/memchr/memchr-help.pd @@ -0,0 +1,22 @@ +#N canvas 0 22 458 308 10; +#X obj 315 16 import jasch_lib; +#X obj 148 156 memchr; +#X floatatom 271 85 5 0 0 0 - - -; +#X obj 147 75 tosymbol; +#X floatatom 149 213 5 0 0 0 - - -; +#X msg 272 106 set :; +#X msg 315 106 set _; +#X msg 361 106 set !; +#X msg 148 53 hallo_this:world!; +#X symbolatom 100 32 20 0 0 0 - - -; +#X obj 100 11 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X connect 1 0 4 0; +#X connect 2 0 1 0; +#X connect 3 0 1 0; +#X connect 5 0 1 0; +#X connect 6 0 1 0; +#X connect 7 0 1 0; +#X connect 8 0 3 0; +#X connect 9 0 1 0; +#X connect 10 0 9 0; diff --git a/memchr/memchr.c b/memchr/memchr.c new file mode 100644 index 0000000..a4b775f --- /dev/null +++ b/memchr/memchr.c @@ -0,0 +1 @@ +/*__________________________________________________________________________
memchr á memchr c-string function
Copyright (C) 2003 jan schacher
thanks to tim place for inspiration and sample code
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 200300505
____________________________________________________________________________*/
#include "m_pd.h"
#include <string.h>
#define MIN(a,b) ((a)<(b)?(a):(b))
typedef struct memchr
{
t_object ob;
void *s_outlet;
char s_tempstring[4096];
long s_numChar;
} t_memchr;
void *memchr_class;
void *memchr_new(t_symbol *s, long argc, t_atom *argv);
void memchr_free(t_memchr *x);
void memchr_float(t_memchr *x, float f);
void memchr_anything(t_memchr *x, t_symbol *s, long argc, t_atom *argv);
void memchr_set(t_memchr *x, t_symbol *s, long argc, t_atom *argv);
void memchr_setup(void)
{
memchr_class = class_new(gensym("memchr"), (t_newmethod)memchr_new, (t_method)memchr_free, sizeof(t_memchr), 0, A_GIMME, 0);
class_addfloat(memchr_class, (t_method)memchr_float);
class_addsymbol(memchr_class, (t_method)memchr_anything);
class_addmethod(memchr_class, (t_method)memchr_set, gensym("set"), A_GIMME, 0);
post(". memchr . jasch . "__DATE__" ",0);
}
void *memchr_new(t_symbol *s, long argc, t_atom *argv)
{
short i;
t_memchr *x;
x = (t_memchr *)pd_new(memchr_class);
x->s_outlet = outlet_new(&x->ob, gensym("float"));
strcpy(x->s_tempstring, "/");
x->s_numChar = 1024;
for(i=0; i<argc; i++){
switch(argv[i].a_type){
case A_FLOAT:
if(i == 1){
x->s_numChar = argv[1].a_w.w_float;
}
break;
case A_SYMBOL:
if(i == 0){
strncpy(x->s_tempstring, argv[0].a_w.w_symbol->s_name, 1);
}
break;
}
}
return (x);
}
void memchr_assist(t_memchr *x, void *b, long msg, long arg, char *dst)
{
if(msg==1)
switch(arg){
case 0: strcpy(dst, "strings in (symbol)"); break;
}
else if(msg==2){
strcpy(dst, "matched positions (int)");
}
}
void memchr_float(t_memchr *x, float f)
{
x->s_numChar = (long)f;
}
void memchr_anything(t_memchr *x, t_symbol *s, long argc, t_atom *argv)
{
char *ptr;
char local[4096];
long pos;
strcpy(local, s->s_name);
ptr = (char*)memchr(local, x->s_tempstring[0], MIN((long)strlen(local), x->s_numChar));
if(ptr != NULL){
pos = (long)(ptr-local+1);
outlet_float(x->s_outlet, pos);
}else{
outlet_float(x->s_outlet,-1);
}
return;
}
void memchr_set(t_memchr *x, t_symbol *s, long argc, t_atom *argv)
{
if(argc >= 1){
switch (argv[0].a_type) {
case A_FLOAT: error("memchr: wrong argument type for set");break;
case A_SYMBOL:
strncpy(x->s_tempstring, argv[0].a_w.w_symbol->s_name, 1);
x->s_tempstring[1] = 0;
break;
}
}
}
void memchr_free(t_memchr *x)
{
// notify_free((t_object *)x);
}
\ No newline at end of file diff --git a/memchr/strchr-help.pd b/memchr/strchr-help.pd new file mode 100644 index 0000000..1358e41 --- /dev/null +++ b/memchr/strchr-help.pd @@ -0,0 +1,22 @@ +#N canvas 0 22 458 308 10; +#X obj 315 16 import jasch_lib; +#X floatatom 271 85 5 0 0 0 - - -; +#X obj 147 75 tosymbol; +#X floatatom 149 213 5 0 0 0 - - -; +#X msg 272 106 set :; +#X msg 315 106 set _; +#X msg 361 106 set !; +#X msg 148 53 hallo_this:world!; +#X symbolatom 100 32 20 0 0 0 - - -; +#X obj 100 11 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 148 156 strchr; +#X connect 1 0 10 0; +#X connect 2 0 10 0; +#X connect 4 0 10 0; +#X connect 5 0 10 0; +#X connect 6 0 10 0; +#X connect 7 0 2 0; +#X connect 8 0 10 0; +#X connect 9 0 8 0; +#X connect 10 0 3 0; diff --git a/memchr/strchr.c b/memchr/strchr.c new file mode 100644 index 0000000..ab67f90 --- /dev/null +++ b/memchr/strchr.c @@ -0,0 +1 @@ +/*__________________________________________________________________________
strchr á strchr c-string function
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 20030507
____________________________________________________________________________*/
#include "m_pd.h"
#include <string.h>
typedef struct strchr
{
t_object ob;
void *s_outlet;
char s_tempstring[4096];
} t_strchr;
void *strchr_class;
void *strchr_new(t_symbol *s, long argc, t_atom *argv);
void strchr_free(t_strchr *x);
void strchr_anything(t_strchr *x, t_symbol *s, long argc, t_atom *argv);
void strchr_set(t_strchr *x, t_symbol *s, long argc, t_atom *argv);
void strchr_setup(void)
{
strchr_class = class_new(gensym("strchr"), (t_newmethod)strchr_new, 0L, sizeof(t_strchr), 0, A_GIMME, 0);
class_addsymbol(strchr_class, (t_method)strchr_anything);
class_addmethod(strchr_class, (t_method)strchr_set, gensym("set"), A_GIMME, 0);
post(". strchr . jasch . "__DATE__"",0);
}
void *strchr_new(t_symbol *s, long argc, t_atom *argv)
{
short i;
t_strchr *x;
x = (t_strchr *)pd_new(strchr_class);
x->s_outlet = outlet_new(&x->ob, gensym("float"));
strcpy(x->s_tempstring, "/");
for(i=0; i<argc; i++){
switch(argv[i].a_type){
case A_SYMBOL:
if(i == 0){
strncpy(x->s_tempstring, argv[0].a_w.w_symbol->s_name, 1);
}
break;
}
}
return (x);
}
void strchr_assist(t_strchr *x, void *b, long msg, long arg, char *dst)
{
if(msg==1)
switch(arg){
case 0: strcpy(dst, "string in (symbol)"); break;
}
else if(msg==2){
strcpy(dst, "matched position (int)");
}
}
void strchr_anything(t_strchr *x, t_symbol *s, long argc, t_atom *argv)
{
char *ptr;
char local[4096];
long pos;
strcpy(local, s->s_name);
ptr = strchr(local, (char)x->s_tempstring[0]);
if(ptr != NULL){
pos = (long)(ptr-local+1);
outlet_float(x->s_outlet, pos);
}else{
outlet_float(x->s_outlet, -1);
}
return;
}
void strchr_set(t_strchr *x, t_symbol *s, long argc, t_atom *argv)
{
{
switch (argv[0].a_type) {
case A_FLOAT: error("strchr: wrong argument type for set");break;
case A_SYMBOL:
strncpy(x->s_tempstring, argv[0].a_w.w_symbol->s_name, 1);
x->s_tempstring[1] = 0;
break;
}
}
}
void strchr_free(t_strchr *x)
{
// notify_free((t_object *)x);
}
\ No newline at end of file diff --git a/strchr/makefile b/strchr/makefile new file mode 100644 index 0000000..52c403a --- /dev/null +++ b/strchr/makefile @@ -0,0 +1,92 @@ +NAME=strchr +CSYM=strchr + +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/strchr/strchr-help.pd b/strchr/strchr-help.pd new file mode 100644 index 0000000..1358e41 --- /dev/null +++ b/strchr/strchr-help.pd @@ -0,0 +1,22 @@ +#N canvas 0 22 458 308 10; +#X obj 315 16 import jasch_lib; +#X floatatom 271 85 5 0 0 0 - - -; +#X obj 147 75 tosymbol; +#X floatatom 149 213 5 0 0 0 - - -; +#X msg 272 106 set :; +#X msg 315 106 set _; +#X msg 361 106 set !; +#X msg 148 53 hallo_this:world!; +#X symbolatom 100 32 20 0 0 0 - - -; +#X obj 100 11 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 148 156 strchr; +#X connect 1 0 10 0; +#X connect 2 0 10 0; +#X connect 4 0 10 0; +#X connect 5 0 10 0; +#X connect 6 0 10 0; +#X connect 7 0 2 0; +#X connect 8 0 10 0; +#X connect 9 0 8 0; +#X connect 10 0 3 0; diff --git a/strchr/strchr.c b/strchr/strchr.c new file mode 100644 index 0000000..ab67f90 --- /dev/null +++ b/strchr/strchr.c @@ -0,0 +1 @@ +/*__________________________________________________________________________
strchr á strchr c-string function
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 20030507
____________________________________________________________________________*/
#include "m_pd.h"
#include <string.h>
typedef struct strchr
{
t_object ob;
void *s_outlet;
char s_tempstring[4096];
} t_strchr;
void *strchr_class;
void *strchr_new(t_symbol *s, long argc, t_atom *argv);
void strchr_free(t_strchr *x);
void strchr_anything(t_strchr *x, t_symbol *s, long argc, t_atom *argv);
void strchr_set(t_strchr *x, t_symbol *s, long argc, t_atom *argv);
void strchr_setup(void)
{
strchr_class = class_new(gensym("strchr"), (t_newmethod)strchr_new, 0L, sizeof(t_strchr), 0, A_GIMME, 0);
class_addsymbol(strchr_class, (t_method)strchr_anything);
class_addmethod(strchr_class, (t_method)strchr_set, gensym("set"), A_GIMME, 0);
post(". strchr . jasch . "__DATE__"",0);
}
void *strchr_new(t_symbol *s, long argc, t_atom *argv)
{
short i;
t_strchr *x;
x = (t_strchr *)pd_new(strchr_class);
x->s_outlet = outlet_new(&x->ob, gensym("float"));
strcpy(x->s_tempstring, "/");
for(i=0; i<argc; i++){
switch(argv[i].a_type){
case A_SYMBOL:
if(i == 0){
strncpy(x->s_tempstring, argv[0].a_w.w_symbol->s_name, 1);
}
break;
}
}
return (x);
}
void strchr_assist(t_strchr *x, void *b, long msg, long arg, char *dst)
{
if(msg==1)
switch(arg){
case 0: strcpy(dst, "string in (symbol)"); break;
}
else if(msg==2){
strcpy(dst, "matched position (int)");
}
}
void strchr_anything(t_strchr *x, t_symbol *s, long argc, t_atom *argv)
{
char *ptr;
char local[4096];
long pos;
strcpy(local, s->s_name);
ptr = strchr(local, (char)x->s_tempstring[0]);
if(ptr != NULL){
pos = (long)(ptr-local+1);
outlet_float(x->s_outlet, pos);
}else{
outlet_float(x->s_outlet, -1);
}
return;
}
void strchr_set(t_strchr *x, t_symbol *s, long argc, t_atom *argv)
{
{
switch (argv[0].a_type) {
case A_FLOAT: error("strchr: wrong argument type for set");break;
case A_SYMBOL:
strncpy(x->s_tempstring, argv[0].a_w.w_symbol->s_name, 1);
x->s_tempstring[1] = 0;
break;
}
}
}
void strchr_free(t_strchr *x)
{
// notify_free((t_object *)x);
}
\ No newline at end of file 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 diff --git a/strlen/makefile b/strlen/makefile new file mode 100644 index 0000000..2817bf1 --- /dev/null +++ b/strlen/makefile @@ -0,0 +1,92 @@ +NAME=strlen +CSYM=strlen + +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/strlen/strlen-help.pd b/strlen/strlen-help.pd new file mode 100644 index 0000000..09202ff --- /dev/null +++ b/strlen/strlen-help.pd @@ -0,0 +1,9 @@ +#N canvas 321 143 454 304 10; +#X obj 321 41 import jasch_lib; +#X obj 144 139 strlen; +#X msg 143 43 alpha; +#X floatatom 145 223 5 0 0 0 - - -; +#X obj 144 68 tosymbol; +#X connect 1 0 3 0; +#X connect 2 0 4 0; +#X connect 4 0 1 0; diff --git a/strlen/strlen.c b/strlen/strlen.c new file mode 100644 index 0000000..67aab65 --- /dev/null +++ b/strlen/strlen.c @@ -0,0 +1 @@ +/*__________________________________________________________________________
strlen á strlen c-string function
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 20030507
____________________________________________________________________________*/
#include "m_pd.h"
#include <strings.h>
typedef struct strlen
{
t_object ob;
void *s_outlet;
float s_length;
} t_strlen;
void *strlen_class;
void *strlen_new(t_symbol *s, long n);
void strlen_anything(t_strlen *x, t_symbol *s, long argc, t_atom *argv);
void strlen_free(t_strlen *x);
void strlen_setup(void)
{
strlen_class = class_new(gensym("strlen"), (t_newmethod)strlen_new,
(t_method)strlen_free, sizeof(t_strlen), 0, A_GIMME, 0);
class_addsymbol(strlen_class, (t_method)strlen_anything);
post(". strlen . jasch . "__DATE__" ",0);
}
void *strlen_new(t_symbol *s, long n)
{
t_strlen *x;
x = (t_strlen *)pd_new(strlen_class);
x->s_outlet = outlet_new(&x->ob, gensym("float"));
return (x);
}
void strlen_anything(t_strlen *x, t_symbol *s, long argc, t_atom *argv)
{
x->s_length = strlen(s->s_name);
outlet_float(x->s_outlet,x->s_length);
}
void strlen_free(t_strlen *x)
{
// notify_free((t_object *)x);
}
\ No newline at end of file diff --git a/strtok/makefile b/strtok/makefile new file mode 100644 index 0000000..6086bc8 --- /dev/null +++ b/strtok/makefile @@ -0,0 +1,92 @@ +NAME=strtok +CSYM=strtok + +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/strtok/strtok-help.pd b/strtok/strtok-help.pd new file mode 100644 index 0000000..067fce8 --- /dev/null +++ b/strtok/strtok-help.pd @@ -0,0 +1,16 @@ +#N canvas 0 22 458 308 10; +#X msg 118 40 alpha/beta/gamma/delta; +#X obj 106 86 tosymbol; +#X obj 106 156 print; +#X msg 236 94 set /; +#X msg 106 21 alpha_beta_gamma_delta; +#X msg 194 94 set _; +#X msg 130 59 alpha:beta:gamma:delta; +#X obj 105 117 strtok /; +#X connect 0 0 1 0; +#X connect 1 0 7 0; +#X connect 3 0 7 0; +#X connect 4 0 1 0; +#X connect 5 0 7 0; +#X connect 6 0 1 0; +#X connect 7 0 2 0; diff --git a/strtok/strtok.c b/strtok/strtok.c new file mode 100644 index 0000000..bdc7223 --- /dev/null +++ b/strtok/strtok.c @@ -0,0 +1 @@ +/*__________________________________________________________________________
strtok á strtok c-string function wrapper
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 20030507
____________________________________________________________________________*/
#include "m_pd.h"
#include <strings.h>
typedef struct strtok
{
t_object ob;
void *s_outlet;
char s_tempstring[4096];
} t_strtok;
void *strtok_class;
void *strtok_new(t_symbol *s, long argc, t_atom *argv);
void strtok_free(t_strtok *x);
//void strtok_assist(t_strtok *x, void *b, long msg, long arg, char *dst);
void strtok_anything(t_strtok *x, t_symbol *s, long argc, t_atom *argv);
void strtok_set(t_strtok *x, t_symbol *s, long argc, t_atom *argv);
void strtok_setup(void)
{
strtok_class = class_new(gensym("strtok"), (t_newmethod)strtok_new,
(t_method)strtok_free, sizeof(t_strtok), 0, A_GIMME, 0);
class_addsymbol(strtok_class, (t_method)strtok_anything);
class_addmethod(strtok_class, (t_method)strtok_set, gensym("set"), A_GIMME, 0);
post(". strtok . jasch . "__DATE__" ",0);
}
void *strtok_new(t_symbol *s, long argc, t_atom *argv)
{
t_strtok *x;
x = (t_strtok *)pd_new(strtok_class);
x->s_outlet = outlet_new(&x->ob, gensym("list"));
if((argc >= 1)&&(argv[0].a_type == A_SYMBOL)){
strcpy(x->s_tempstring, argv[0].a_w.w_symbol->s_name);
// post("argument is %s", argv[0].a_w.w_symbol->s_name);
}else{
strcpy(x->s_tempstring, "/");
// post("defualt-argument is %s", x->s_tempstring);
}
return (x);
}
void strtok_anything(t_strtok *x, t_symbol *s, long argc, t_atom *argv)
{
char *ptr;
char local[4096];
long status = 0;
short i, j;
t_atom result[256];
t_atom head;
i = 0;
strcpy(local, s->s_name);
ptr = strtok(local,x->s_tempstring);
while (ptr != NULL){
result[i].a_type = A_SYMBOL;
result[i].a_w.w_symbol = gensym(ptr);
ptr = strtok (NULL, x->s_tempstring);
i++;
}
j = i;
head.a_w.w_symbol = result[0].a_w.w_symbol;
for(j=0;j<i;j++) result[j] = result[j+1];
outlet_anything(x->s_outlet,head.a_w.w_symbol,i-1,result);
return;
}
void strtok_set(t_strtok *x, t_symbol *s, long argc, t_atom *argv)
{
switch (argv[0].a_type) {
case A_FLOAT: error("wrong argument type for set");break;
// case A_LONG:error("wrong argument type for set"); break;
case A_SYMBOL: strcpy(x->s_tempstring, argv[0].a_w.w_symbol->s_name); break;
}
}
void strtok_free(t_strtok *x)
{
// notify_free((t_object *)x);
}
\ No newline at end of file |