diff options
author | jasch <j45ch@users.sourceforge.net> | 2007-07-15 22:10:54 +0000 |
---|---|---|
committer | jasch <j45ch@users.sourceforge.net> | 2007-07-15 22:10:54 +0000 |
commit | 0e53ee1a6f430d42b1509c1bad12f59747a47f97 (patch) | |
tree | b8254807b5a8b736346ddd56ba93472d379bee13 /strchr | |
parent | dc75bfe5defab2bad40aa3c90a9d21a608f44cd7 (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 'strchr')
-rw-r--r-- | strchr/makefile | 92 | ||||
-rw-r--r-- | strchr/strchr-help.pd | 22 | ||||
-rw-r--r-- | strchr/strchr.c | 1 |
3 files changed, 115 insertions, 0 deletions
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 |