diff options
author | jasch <j45ch@users.sourceforge.net> | 2006-05-18 10:54:32 +0000 |
---|---|---|
committer | jasch <j45ch@users.sourceforge.net> | 2006-05-18 10:54:32 +0000 |
commit | 3220b519e5179ec5d0f1e2a7e6be4571dd9c051a (patch) | |
tree | a812d6b6f8a412e048f9cfcbca514f014e13a001 | |
parent | 79e92099a6bad99a6e6eba6e0abd3f74eedea61a (diff) |
This commit was generated by cvs2svn to compensate for changes in r5079,
which included commits to RCS files with non-trunk default branches.
svn path=/trunk/externals/jasch_lib/; revision=5080
-rw-r--r-- | underscore/_-help.pd | 75 | ||||
-rw-r--r-- | underscore/makefile | 92 | ||||
-rw-r--r-- | underscore/underscore.c | 1 |
3 files changed, 168 insertions, 0 deletions
diff --git a/underscore/_-help.pd b/underscore/_-help.pd new file mode 100644 index 0000000..f8b1e07 --- /dev/null +++ b/underscore/_-help.pd @@ -0,0 +1,75 @@ +#N canvas 0 22 804 338 10; +#X obj 153 192 _; +#X obj 153 228 print; +#X floatatom 154 131 5 0 0 0 - - -; +#X msg 162 147 some message; +#X floatatom 346 136 5 0 0 0 - - -; +#X obj 333 222 _ alpha; +#X symbolatom 363 173 10 0 0 0 - - -; +#X obj 440 14 import jasch_lib; +#X obj 334 248 _; +#X msg 359 248 alpha 1 2 3 4; +#X symbolatom 170 167 10 0 0 0 - - -; +#X text 308 13 comment; +#X obj -20 13 cnv 15 780 40 empty empty _(underscore) 20 12 0 24 -233139 +-66577 0; +#X text 666 18 jasch 05/2006; +#X text 624 34 http://www.jasch.ch; +#X obj 646 61 import jasch_lib; +#X text 208 20 lazy man's prepender; +#X msg 370 190 1 2 3 4; +#X obj 334 115 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X msg 355 153 any old message; +#X text 208 34 argument (optional): prependee (default "set"); +#N canvas 387 94 429 483 more 0; +#X msg 96 71 1; +#X obj 96 50 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X msg 96 159 11 22; +#X msg 96 115 symbol foo; +#X msg 96 93 float 1.1; +#X msg 96 137 set; +#X msg 96 182 list -55 -66; +#X msg 96 205 list aaa 123; +#X msg 96 228 jkl 555 uuu; +#X obj 96 318 route bang float symbol list; +#X obj 95 367 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 142 368 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 191 367 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 239 367 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 287 366 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X text 308 366 anything; +#X obj 96 273 _; +#X connect 0 0 16 0; +#X connect 1 0 16 0; +#X connect 2 0 16 0; +#X connect 3 0 16 0; +#X connect 4 0 16 0; +#X connect 5 0 16 0; +#X connect 6 0 16 0; +#X connect 7 0 16 0; +#X connect 8 0 16 0; +#X connect 9 0 10 0; +#X connect 9 1 11 0; +#X connect 9 2 12 0; +#X connect 9 3 13 0; +#X connect 9 4 14 0; +#X connect 16 0 9 0; +#X restore 581 210 pd more; +#X connect 0 0 1 0; +#X connect 2 0 0 0; +#X connect 3 0 0 0; +#X connect 4 0 5 0; +#X connect 5 0 8 0; +#X connect 6 0 5 0; +#X connect 8 0 9 0; +#X connect 10 0 0 0; +#X connect 17 0 5 0; +#X connect 18 0 5 0; +#X connect 19 0 5 0; diff --git a/underscore/makefile b/underscore/makefile new file mode 100644 index 0000000..1a41c0e --- /dev/null +++ b/underscore/makefile @@ -0,0 +1,92 @@ +NAME=underscore +CSYM=_ + +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/underscore/underscore.c b/underscore/underscore.c new file mode 100644 index 0000000..c95e6e2 --- /dev/null +++ b/underscore/underscore.c @@ -0,0 +1 @@ +/*__________________________________________________________________________
_ á (underscore) prepend setter
Copyright © 2002-2006 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
revision history:
20040303 rebuilt release
20060516 PD-port
____________________________________________________________________________*/
#include "m_pd.h"
#define MAXSIZE 1024
#define MIN(a,b) ((a)<(b)?(a):(b))
typedef struct underscore {
t_object ob;
t_atom p_at[MAXSIZE*2];
int p_headlength, p_bodylength;
void *p_outlet;
} t_underscore;
void *underscore_class;
void *underscore_new(t_symbol *s, short ac, t_atom *av);
void underscore_bang(t_underscore *x);
void underscore_float(t_underscore *x, double f);
void underscore_anything(t_underscore *x, t_symbol *s, short ac, t_atom *av);
void underscore_set(t_underscore *x, t_symbol *s, short ac, t_atom *av);
void underscore_list(t_underscore *x, t_symbol *s, short ac, t_atom *av);
void underscore_output(t_underscore *x);
t_symbol *ps_bang;
t_symbol *ps_set;
void __setup(void)
{
underscore_class = class_new(gensym("_"), (t_newmethod)underscore_new, 0L, sizeof(t_underscore), 0, A_GIMME, 0);
class_addbang(underscore_class, (t_method)underscore_bang);
class_addfloat(underscore_class, (t_method)underscore_float);
class_addmethod(underscore_class, (t_method)underscore_list, gensym("list"), A_GIMME, 0);
class_addanything(underscore_class, (t_method)underscore_anything);
class_addmethod(underscore_class, (t_method)underscore_set, gensym("set"), A_GIMME, 0);
post(". _ . jasch . "__DATE__" ",0);
ps_bang = gensym("bang");
ps_set = gensym("set");
}
void *underscore_new(t_symbol *s, short ac, t_atom *av)
{
t_underscore *x;
int i;
t_atom *at;
x = (t_underscore *)pd_new(underscore_class);
x->p_outlet = outlet_new(&x->ob,0);
at = x->p_at;
x->p_headlength = 1;
x->p_bodylength = 0;
at[0].a_type = A_SYMBOL;
at[0].a_w.w_symbol = ps_set;
if(ac != 0){
ac = MIN(MAXSIZE, ac);
x->p_headlength = ac;
for (i=0; i<ac; ++i) *at++ = *av++;
}
return x;
}
void underscore_bang(t_underscore *x)
{
t_atom *at;
at = x->p_at;
x->p_bodylength = 1;
x->p_at[x->p_headlength].a_type = A_SYMBOL;
x->p_at[x->p_headlength].a_w.w_symbol = ps_bang;
underscore_output(x) ;
}
void underscore_float(t_underscore *x, double f)
{
t_atom *at;
at = x->p_at;
x->p_bodylength = 1;
SETFLOAT(at+(x->p_headlength), f);
underscore_output(x) ;
}
void underscore_list(t_underscore *x, t_symbol *s, short ac, t_atom *av)
{
t_atom *at;
int i, temp;
ac = MIN(MAXSIZE, ac);
x->p_bodylength = ac; // indicates input list length
temp = x->p_headlength;
at = x->p_at;
at = at + temp;
ac = MIN(MAXSIZE, ac);
for (i=0; i<ac; i++) *at++ = *av++;
underscore_output(x) ;
}
void underscore_anything(t_underscore *x, t_symbol *s, short ac, t_atom *av)
{
int i, temp;
t_atom *at;
temp = x->p_headlength;
at = x->p_at;
ac = MIN(MAXSIZE-1, ac);
x->p_bodylength = ac+1;
at = x->p_at;
at = at + temp+1;
x->p_at[temp].a_type = A_SYMBOL;
x->p_at[temp].a_w.w_symbol = s;
for (i=(temp+1); i<(ac+temp+1); i++) *at++ = *av++;
underscore_output(x) ;
}
void underscore_set(t_underscore *x, t_symbol *s, short ac, t_atom *av)
{
t_atom *at;
int i, temp;
at = x->p_at;
x->p_headlength = ac; // indicates input list length
ac = MIN(MAXSIZE, ac);
for (i=0; i<ac; i++) *at++ = *av++;
}
void underscore_output(t_underscore *x)
{
t_atom *at;
t_atom atoms[MAXSIZE*2];
int i, outlength;
t_symbol *s;
at = x->p_at;
outlength = MIN(MAXSIZE, (x->p_headlength+x->p_bodylength));
if(x->p_at[0].a_type != A_SYMBOL){
outlet_list(x->p_outlet, 0L, outlength, at);
}else{
at ++;
s = x->p_at[0].a_w.w_symbol;
outlet_anything(x->p_outlet, s, outlength-1, at);
}
}
\ No newline at end of file |