diff options
author | IOhannes m zmölnig <zmoelnig@users.sourceforge.net> | 2007-03-19 15:56:56 +0000 |
---|---|---|
committer | IOhannes m zmölnig <zmoelnig@users.sourceforge.net> | 2007-03-19 15:56:56 +0000 |
commit | 0bcda635cb0d2b90e6f7d1718486e9ffeb1d3a71 (patch) | |
tree | f5c8bb254c3700ba787540413884f43e30831a1a /src | |
parent | 5e02a5596fc9af6903b1b7ba950d83eb7e11a711 (diff) |
added an aliasing "system": only the master objects are kept in CVS;
aliases are copied (or linked) from the master objects
svn path=/trunk/externals/zexy/; revision=7507
Diffstat (limited to 'src')
-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 |
4 files changed, 114 insertions, 3 deletions
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 + |