diff options
-rw-r--r-- | abs/alias | 2 | ||||
-rw-r--r-- | abs/any2list-help.pd | 24 | ||||
-rw-r--r-- | abs/any2list.pd | 12 | ||||
-rw-r--r-- | abs/list2int-help.pd | 18 | ||||
-rw-r--r-- | abs/list2int.pd | 53 | ||||
-rw-r--r-- | reference/a2l-help (renamed from reference/any2list-help.pd) | 0 | ||||
-rw-r--r-- | src/Makefile | 12 | ||||
-rw-r--r-- | src/a2l.c | 4 | ||||
-rw-r--r-- | src/alias | 11 | ||||
-rwxr-xr-x | src/makealias.sh | 90 |
10 files changed, 187 insertions, 39 deletions
diff --git a/abs/alias b/abs/alias new file mode 100644 index 0000000..92f4cf4 --- /dev/null +++ b/abs/alias @@ -0,0 +1,2 @@ +a2l any2list +list2int l2i diff --git a/abs/any2list-help.pd b/abs/any2list-help.pd deleted file mode 100644 index c15f9d1..0000000 --- a/abs/any2list-help.pd +++ /dev/null @@ -1,24 +0,0 @@ -#N canvas 319 129 450 458 10; -#X text 113 30 convert "anything" to lists; -#X text 116 56 pass through the rest; -#X floatatom 46 229 0 0 0 0 - - -; -#X symbolatom 46 203 0 0 0 0 - - -; -#X msg 46 162 this is anything; -#X msg 46 182 list this is a list; -#X obj 35 276 print a2l; -#X text 43 328 to make "anything"s out of lists \, try; -#X obj 299 369 route list; -#X msg 299 348 list this is a list; -#X obj 299 389 print l2a; -#X obj 48 30 any2list; -#X text 245 223 alias; -#X obj 286 223 a2l; -#X obj 35 256 any2list; -#X text 356 6 part of zexy; -#X connect 2 0 14 0; -#X connect 3 0 14 0; -#X connect 4 0 14 0; -#X connect 5 0 14 0; -#X connect 8 0 10 0; -#X connect 9 0 8 0; -#X connect 14 0 6 0; diff --git a/abs/any2list.pd b/abs/any2list.pd deleted file mode 100644 index a97966f..0000000 --- a/abs/any2list.pd +++ /dev/null @@ -1,12 +0,0 @@ -#N canvas 0 0 450 300 10; -#X obj 74 50 inlet; -#X obj 74 172 outlet; -#X obj 74 107 route bang; -#X obj 149 128 list; -#X text 286 38 part of zexy; -#X text 174 81 requires pd>=0.39; -#X text 58 25 convert anything into lists; -#X connect 0 0 2 0; -#X connect 2 0 1 0; -#X connect 2 1 3 0; -#X connect 3 0 1 0; diff --git a/abs/list2int-help.pd b/abs/list2int-help.pd new file mode 100644 index 0000000..607183e --- /dev/null +++ b/abs/list2int-help.pd @@ -0,0 +1,18 @@ +#N canvas 265 308 612 302 12; +#X obj 106 246 print; +#X msg 141 139 3.14159 2 hello 1; +#X msg 150 170 gosh 2.3 1; +#X obj 106 212 list2int; +#X text 145 23 list to integer; +#X text 98 49 cast all floats of a list to integers; +#X msg 106 110 1 2 -1.567 3 2; +#X text 238 110 list of floats; +#X text 304 139 list with symbols; +#X obj 412 248 l2i; +#X text 365 248 alias; +#X text 451 15 part of zexy; +#X text 248 169 not really a list; +#X connect 1 0 3 0; +#X connect 2 0 3 0; +#X connect 3 0 0 0; +#X connect 6 0 3 0; diff --git a/abs/list2int.pd b/abs/list2int.pd new file mode 100644 index 0000000..33938d1 --- /dev/null +++ b/abs/list2int.pd @@ -0,0 +1,53 @@ +#N canvas 0 0 450 496 10; +#X obj 94 139 inlet; +#X obj 94 457 outlet; +#X obj 94 245 repack 1; +#X obj 163 245 length; +#X obj 94 315 repack; +#X obj 94 270 route float; +#X obj 94 291 int; +#X obj 94 223 t a a; +#X text 30 24 (c) 2006 IOhannes m zmoelnig \, IEM; +#X text 31 75 cast any float in a list to integer. leave the rest untouched. +; +#X obj 94 162 route list; +#X obj 94 191 t a b; +#X obj 169 190 t a b; +#X obj 94 361 spigot 1; +#X obj 172 360 spigot 0; +#X obj 172 382 list trim; +#X obj 94 340 t l l; +#X obj 94 418 t a; +#X obj 153 340 != 0; +#X obj 231 340 == 0; +#X obj 153 320 t f f; +#X msg 153 298 1; +#X msg 185 298 0; +#X text 34 48 part of zexy; +#X connect 0 0 10 0; +#X connect 2 0 5 0; +#X connect 3 0 4 1; +#X connect 4 0 16 0; +#X connect 5 0 6 0; +#X connect 5 1 4 0; +#X connect 6 0 4 0; +#X connect 7 0 2 0; +#X connect 7 1 3 0; +#X connect 10 0 11 0; +#X connect 10 1 12 0; +#X connect 11 0 7 0; +#X connect 11 1 21 0; +#X connect 12 0 7 0; +#X connect 12 1 22 0; +#X connect 13 0 17 0; +#X connect 14 0 15 0; +#X connect 15 0 17 0; +#X connect 16 0 13 0; +#X connect 16 1 14 0; +#X connect 17 0 1 0; +#X connect 18 0 13 1; +#X connect 19 0 14 1; +#X connect 20 0 18 0; +#X connect 20 1 19 0; +#X connect 21 0 20 0; +#X connect 22 0 20 0; diff --git a/reference/any2list-help.pd b/reference/a2l-help index bfd7c15..bfd7c15 100644 --- a/reference/any2list-help.pd +++ b/reference/a2l-help diff --git a/src/Makefile b/src/Makefile index 44d4ec9..9ded18f 100644 --- a/src/Makefile +++ b/src/Makefile @@ -89,7 +89,17 @@ distclean: realclean tests: all make -C $(TESTDIR) -install: install-abs install-bin install-doc +alias: alias-bin alias-abs + +alias-bin: all + ./makealias.sh ../src/alias ../src ../reference + + +alias-abs: + ./makealias.sh ../abs/alias ../abs + + +install: all install-abs install-bin install-doc install-bin: -install -d $(INSTALL_BIN) @@ -73,9 +73,9 @@ static void *a2l_new(void) void a2l_setup(void) { - a2l_class = class_new(gensym("any2list"), (t_newmethod)a2l_new, + a2l_class = class_new(gensym("a2l"), (t_newmethod)a2l_new, 0, sizeof(t_a2l), 0, 0); - class_addcreator((t_newmethod)a2l_new, gensym("a2l"), 0); + class_addcreator((t_newmethod)a2l_new, gensym("any2list"), 0); class_addbang (a2l_class, a2l_bang); diff --git a/src/alias b/src/alias new file mode 100644 index 0000000..22fab27 --- /dev/null +++ b/src/alias @@ -0,0 +1,11 @@ +a2l any2list +demultiplex~ demux~ +demultiplex demux +drip unfold +list2int l2i +list2symbol l2s +lister l +lpt lp +multiplex~ mux~ +multiplex mux +symbol2list s2l diff --git a/src/makealias.sh b/src/makealias.sh new file mode 100755 index 0000000..4617bc9 --- /dev/null +++ b/src/makealias.sh @@ -0,0 +1,90 @@ +#!/bin/sh + +EXTENSIONS=".pd -help.pd .pd_linux .pd_darwin .pd_freebsd .dll .b_i386 .l_ia64 .l_i386 .d_fat .d_i386 .d_ppc .m_i386" + +ALIASFILE=$1 +shift + +if [ "x$ALIASFILE" = "x-clean" ] +then + CLEANMODE=yes + ALIASFILE=$1 + shift +else + CLEANMODE= +fi + + +if [ -e "${ALIASFILE}" ]; then :; else + echo cannot find alias-file ${ALIASFILE} + exit 1 +fi + + +function debug() { + : +# echo $@ +} + +function do_makealias() { + if [ "x${CLEANMODE}" = "xyes" ] + then + if [ -e "$2" ]; then + debug "removing alias $2" + rm $2 + else + debug "alias $2 does not exist" + fi + else + debug "aliasing $1 to $2" + ln -s $1 $2 + fi +} + +function do_makealiases() { + local dir + local master + local slave + local extension + + dir=$1 + master=$2 + shift; shift + + if [ "x${master}" = "x" ]; then + # no realname provided + return + fi + + if [ "x$@" = "x" ]; then + # no aliases provided... + return + fi + + for extension in ${EXTENSIONS} + do +# echo "checking aliases for ${dir}/${master}${extension}" + if [ -f "${dir}/${master}${extension}" ] + then + for slave in $@ + do + do_makealias ${dir}/${master}${extension} ${dir}/${slave}${extension} + done + fi + done +} + +for d in $@ +do + if [ -d "$d" ] + then + debug "scanning directory $d for aliases" + cat ${ALIASFILE} | while read line + do + do_makealiases $d $line + done + else + echo "skipping non-directory $d" + fi +done + |