aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2005-03-22 20:58:25 +0000
committerIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2005-03-22 20:58:25 +0000
commit2b60d55c919e7588f5aff15936e83c300b3660bb (patch)
tree14d860de7f28083d3756ad91b627de70f26788f6 /src
parentc500bc542cb7cc78d6dac3f7da3bff626056b1aa (diff)
zexy-2.0:
- use of abstractions for objects that allow it - some objects are build both as externals and abstractions (as slower fallbacks) - code-layout is now 1:1 c-file<->object (this should allow for building of zexy as a collection of externals instead as a big library) - matrix-objects have moved to iemmatrix !! svn path=/trunk/externals/zexy/; revision=2641
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.in (renamed from src/makefile.in)22
-rw-r--r--src/a2l.c90
-rw-r--r--src/atoi.c98
-rw-r--r--src/avg_tilde.c85
-rw-r--r--src/blockmirror_tilde.c104
-rw-r--r--src/blockswap_tilde.c99
-rwxr-xr-xsrc/configure4724
-rw-r--r--src/configure.in13
-rw-r--r--src/date.c (renamed from src/z_datetime.c)113
-rw-r--r--src/demultiplex.c (renamed from src/z_multiplex.c)96
-rw-r--r--src/demultiplex_tilde.c119
-rw-r--r--src/dfreq_tilde.c (renamed from src/z_dfreq.c)25
-rw-r--r--src/dirac_tilde.c113
-rw-r--r--src/dot.c162
-rw-r--r--src/drip.c (renamed from src/z_drip.c)19
-rw-r--r--src/envrms_tilde.c (renamed from src/z_sigaverage.c)181
-rw-r--r--src/glue.c114
-rw-r--r--src/index.c (renamed from src/z_index.c)19
-rw-r--r--src/length.c61
-rw-r--r--src/limiter_tilde.c (renamed from src/z_limiter.c)30
-rw-r--r--src/list2int.c81
-rw-r--r--src/list2symbol.c141
-rw-r--r--src/lister.c84
-rw-r--r--src/lpt.c (renamed from src/z_lp.c)128
-rw-r--r--src/makefile2
-rw-r--r--src/makefile.darwin167
-rw-r--r--src/makefile.irix29
-rw-r--r--src/makefile.linux94
-rwxr-xr-xsrc/makefile.nt30
-rwxr-xr-xsrc/makefile.win58
-rwxr-xr-xsrc/makesource.sh68
-rw-r--r--src/makesymbol.c (renamed from src/z_makesymbol.c)22
-rw-r--r--src/mavg.c (renamed from src/z_average.c)33
-rw-r--r--src/minmax.c84
-rw-r--r--src/msgfile.c (renamed from src/z_msgfile.c)37
-rw-r--r--src/multiline_tilde.c (renamed from src/z_multiline.c)25
-rw-r--r--src/multiplex.c106
-rw-r--r--src/multiplex_tilde.c112
-rw-r--r--src/niagara.c110
-rw-r--r--src/noish_tilde.c184
-rw-r--r--src/noisi_tilde.c (renamed from src/z_noise.c)162
-rw-r--r--src/operating_system.c (renamed from src/z_operating_system.c)20
-rw-r--r--src/pack_tilde.c86
-rw-r--r--src/packel.c107
-rw-r--r--src/pdf_tilde.c (renamed from src/z_pdf.c)24
-rw-r--r--src/prime.c (renamed from src/z_prime.c)21
-rw-r--r--src/quantize_tilde.c (renamed from src/z_quantize.c)54
-rw-r--r--src/repack.c182
-rw-r--r--src/repeat.c60
-rw-r--r--src/sfplay.c (renamed from src/z_sfplay.c)19
-rw-r--r--src/sfrecord.c (renamed from src/z_sfrecord.c)21
-rw-r--r--src/sigzero_tilde.c (renamed from src/z_sigzero.c)23
-rw-r--r--src/sort.c (renamed from src/z_sort.c)18
-rw-r--r--src/step_tilde.c (renamed from src/z_testfun.c)115
-rw-r--r--src/strcmp.c103
-rw-r--r--src/sum.c61
-rw-r--r--src/swap_tilde.c101
-rw-r--r--src/symbol2list.c163
-rw-r--r--src/tabdump.c117
-rw-r--r--src/tabminmax.c140
-rw-r--r--src/tabset.c102
-rw-r--r--src/tavg_tilde.c99
-rw-r--r--src/time.c122
-rw-r--r--src/unpack_tilde.c (renamed from src/z_sigpack.c)108
-rw-r--r--src/urn.c (renamed from src/z_random.c)23
-rw-r--r--src/winNT_portio.c107
-rw-r--r--src/wrap.c (renamed from src/z_wrap.c)19
-rw-r--r--src/z_connective.c621
-rw-r--r--src/z_coordinates.c440
-rw-r--r--src/z_matrix.c2706
-rw-r--r--src/z_nop.c78
-rw-r--r--src/z_pack.c350
-rw-r--r--src/z_sigbin.c19
-rw-r--r--src/z_sigmatrix.c506
-rw-r--r--src/z_skeleton.c57
-rw-r--r--src/z_skeleton_tilde.c61
-rw-r--r--src/z_stat.c168
-rw-r--r--src/z_strings.c433
-rw-r--r--src/z_swap.c262
-rw-r--r--src/z_tabread4.c312
-rw-r--r--src/z_tilde.c (renamed from src/z_zdelay.c)24
-rw-r--r--src/zexy.c154
-rw-r--r--src/zexy.dsp175
-rw-r--r--src/zexy.h40
84 files changed, 4390 insertions, 12075 deletions
diff --git a/src/makefile.in b/src/Makefile.in
index ffb3705..5466507 100644
--- a/src/makefile.in
+++ b/src/Makefile.in
@@ -24,7 +24,9 @@ CFLAGS = -g -O2 $(DEFS) $(IFLAGS) $(WFLAGS)
LIBS = @LIBS@
#LIBS = -lpthread -lm -lc
-include make.source
+
+include Make.source
+
TARGETS = $(SOURCES:.c=.o)
@@ -51,11 +53,11 @@ cleaner: clean
-rm -f *~ _* config.*
cleanest: cleaner
- -rm -f makefile ../*.$(EXT) make.source
+ -rm -f Makefile ../*.$(EXT) Make.source
distclean: cleanest newmakefile
-install: install-bin install-doc
+install: install-bin install-doc install-abs
install-bin:
-install -d $(INSTALL_BIN)
@@ -65,16 +67,20 @@ install-doc:
-install -d $(INSTALL_DOC)
-install -m 644 ../examples/*.pd $(INSTALL_DOC)
+install-abs:
+ -install -d $(INSTALL_BIN)
+ -install -m 644 ../abs/*.pd $(INSTALL_BIN)
+
dist: all cleaner
(cd ../..;tar czvf $(TARNAME) $(LIBNAME))
everything: clean all install distclean
newmakefile:
- echo "current:">makefile
- echo " ./configure && make">>makefile
+ echo "current:">Makefile
+ echo " ./configure && make">>Makefile
make.source:
- echo "SOURCES = \\"> make.source
- echo `ls z_*.c $(LIBNAME).c` >> make.source
- echo >> make.source
+ echo "SOURCES = \\"> Make.source
+ echo `ls z_*.c $(LIBNAME).c` >> Make.source
+ echo >> Make.source
diff --git a/src/a2l.c b/src/a2l.c
new file mode 100644
index 0000000..8b8efbe
--- /dev/null
+++ b/src/a2l.c
@@ -0,0 +1,90 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
+
+/* 2305:forum::für::umläute:2001 */
+
+#include "zexy.h"
+#include <string.h>
+
+/* ------------------------- a2l ------------------------------- */
+
+/* convert anythings to lists, pass through the rest */
+
+static t_class *a2l_class;
+
+typedef struct _a2l
+{
+ t_object x_obj;
+} t_a2l;
+
+static void a2l_anything(t_a2l *x, t_symbol *s, int argc, t_atom *argv)
+{
+ int n = argc+1;
+ t_atom *cur, *alist = (t_atom *)getbytes(n * sizeof(t_atom));
+
+ cur = alist;
+ SETSYMBOL(cur, s);
+ cur++;
+
+ memcpy(cur, argv, argc * sizeof(t_atom));
+
+ outlet_list(x->x_obj.ob_outlet, gensym("list"), n, alist);
+
+ freebytes(alist, n * sizeof(t_atom));
+
+}
+
+static void a2l_list(t_a2l *x, t_symbol *s, int argc, t_atom *argv)
+{ outlet_list(x->x_obj.ob_outlet, s, argc, argv);}
+
+static void a2l_float(t_a2l *x, t_floatarg f)
+{ outlet_float(x->x_obj.ob_outlet, f);}
+
+static void a2l_symbol(t_a2l *x, t_symbol *s)
+{ outlet_symbol(x->x_obj.ob_outlet, s);}
+
+static void a2l_pointer(t_a2l *x, t_gpointer *gp)
+{ outlet_pointer(x->x_obj.ob_outlet, gp);}
+
+static void a2l_bang(t_a2l *x)
+{ outlet_bang(x->x_obj.ob_outlet);}
+
+static void *a2l_new(void)
+{
+ t_a2l *x = (t_a2l *)pd_new(a2l_class);
+ outlet_new(&x->x_obj, 0);
+ return (x);
+}
+
+void a2l_setup(void)
+{
+
+ a2l_class = class_new(gensym("any2list"), (t_newmethod)a2l_new,
+ 0, sizeof(t_a2l), 0, 0);
+ class_addcreator((t_newmethod)a2l_new, gensym("a2l"), 0);
+
+
+ class_addbang (a2l_class, a2l_bang);
+ class_addfloat (a2l_class, a2l_float);
+ class_addsymbol (a2l_class, a2l_symbol);
+ class_addpointer (a2l_class, a2l_pointer);
+ class_addlist (a2l_class, a2l_list);
+ class_addanything(a2l_class, a2l_anything);
+
+ class_sethelpsymbol(a2l_class, gensym("zexy/any2list"));
+ zexy_register("a2l");
+}
diff --git a/src/atoi.c b/src/atoi.c
new file mode 100644
index 0000000..2dcd325
--- /dev/null
+++ b/src/atoi.c
@@ -0,0 +1,98 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
+
+#include "zexy.h"
+#include <stdlib.h>
+#include <string.h>
+
+/*
+ * atoi : ascii to integer
+*/
+
+/* atoi :: ascii to integer */
+
+static t_class *atoi_class;
+
+typedef struct _atoi
+{
+ t_object x_obj;
+ int i;
+} t_atoi;
+static void atoi_bang(t_atoi *x)
+{
+ outlet_float(x->x_obj.ob_outlet, (t_float)x->i);
+}
+static void atoi_float(t_atoi *x, t_floatarg f)
+{
+ x->i = f;
+ outlet_float(x->x_obj.ob_outlet, (t_float)x->i);
+}
+static void atoi_symbol(t_atoi *x, t_symbol *s)
+{
+ int base=10;
+ const char* c = s->s_name;
+ if(c[0]=='0'){
+ base=8;
+ if (c[1]=='x')base=16;
+ }
+ x->i=strtol(c, 0, base);
+ outlet_float(x->x_obj.ob_outlet, (t_float)x->i);
+}
+static void atoi_list(t_atoi *x, t_symbol *s, int argc, t_atom *argv)
+{
+ int base=10;
+ const char* c;
+
+ if (argv->a_type==A_FLOAT){
+ x->i=atom_getfloat(argv);
+ outlet_float(x->x_obj.ob_outlet, (t_float)x->i);
+ return;
+ }
+
+ if (argc>1){
+ base=atom_getfloat(argv+1);
+ if (base<2) {
+ error("atoi: setting base to 10");
+ base=10;
+ }
+ }
+ c=atom_getsymbol(argv)->s_name;
+ x->i=strtol(c, 0, base);
+ outlet_float(x->x_obj.ob_outlet, (t_float)x->i);
+}
+
+static void *atoi_new(void)
+{
+ t_atoi *x = (t_atoi *)pd_new(atoi_class);
+ outlet_new(&x->x_obj, gensym("float"));
+ return (x);
+}
+
+void atoi_setup(void)
+{
+ atoi_class = class_new(gensym("atoi"), (t_newmethod)atoi_new, 0,
+ sizeof(t_atoi), 0, A_DEFFLOAT, 0);
+
+ class_addbang(atoi_class, (t_method)atoi_bang);
+ class_addfloat(atoi_class, (t_method)atoi_float);
+ class_addlist(atoi_class, (t_method)atoi_list);
+ class_addsymbol(atoi_class, (t_method)atoi_symbol);
+ class_addanything(atoi_class, (t_method)atoi_symbol);
+
+ class_sethelpsymbol(atoi_class, gensym("zexy/atoi"));
+ zexy_register("atoi");
+}
diff --git a/src/avg_tilde.c b/src/avg_tilde.c
new file mode 100644
index 0000000..5011cee
--- /dev/null
+++ b/src/avg_tilde.c
@@ -0,0 +1,85 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
+#include "zexy.h"
+#include <math.h>
+
+/* ------------------------ average~ ----------------------------- */
+
+/* tilde object to take absolute value. */
+
+static t_class *avg_class;
+
+typedef struct _avg
+{
+ t_object x_obj;
+
+ t_float n_inv;
+ t_float buf;
+ int blocks;
+} t_avg;
+
+
+/* average :: arithmetic mean of one signal-vector */
+
+static t_int *avg_perform(t_int *w)
+{
+ t_float *in = (t_float *)(w[1]);
+
+ t_avg *x = (t_avg *)w[2];
+ int n = (int)(w[3]);
+
+ t_float buf = 0.;
+
+ while (n--)
+ {
+ buf += *in++;
+ }
+ outlet_float(x->x_obj.ob_outlet, buf*x->n_inv);
+
+ return (w+4);
+}
+
+static void avg_dsp(t_avg *x, t_signal **sp)
+{
+ x->n_inv=1./sp[0]->s_n;
+ dsp_add(avg_perform, 3, sp[0]->s_vec, x, sp[0]->s_n);
+}
+
+static void *avg_new(void)
+{
+ t_avg *x = (t_avg *)pd_new(avg_class);
+ outlet_new(&x->x_obj, gensym("float"));
+ return (x);
+}
+
+static void avg_help(void)
+{
+ post("avg~\t:: outputs the arithmetic mean of each signal-vector");
+}
+
+
+void avg_tilde_setup(void)
+{
+ avg_class = class_new(gensym("avg~"), (t_newmethod)avg_new, 0,
+ sizeof(t_avg), 0, A_DEFFLOAT, 0);
+ class_addmethod(avg_class, nullfn, gensym("signal"), 0);
+ class_addmethod(avg_class, (t_method)avg_dsp, gensym("dsp"), 0);
+
+ class_addmethod(avg_class, (t_method)avg_help, gensym("help"), 0);
+ class_sethelpsymbol(avg_class, gensym("zexy/avg~"));
+ zexy_register("avg~");
+}
diff --git a/src/blockmirror_tilde.c b/src/blockmirror_tilde.c
new file mode 100644
index 0000000..5c0efcc
--- /dev/null
+++ b/src/blockmirror_tilde.c
@@ -0,0 +1,104 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
+/*
+ 1110:forum::für::umläute:1999
+*/
+
+#include "zexy.h"
+
+/* ------------------------ blockmirror~ ----------------------------- */
+
+/* mirrors a signalblock around it's center:
+ {x[0], x[1], ... x[n-1]} --> {x[n-1], x[n-2], ... x[0]}
+*/
+
+static t_class *blockmirror_class;
+
+typedef struct _blockmirror
+{
+ t_object x_obj;
+ int doit;
+ int blocksize;
+ t_float *blockbuffer;
+} t_blockmirror;
+
+static void blockmirror_float(t_blockmirror *x, t_floatarg f)
+{
+ x->doit = (f != 0);
+}
+
+static t_int *blockmirror_perform(t_int *w)
+{
+ t_blockmirror *x = (t_blockmirror *)(w[1]);
+ t_float *in = (t_float *)(w[2]);
+ t_float *out = (t_float *)(w[3]);
+ int n = (int)(w[4]);
+ if (x->doit) {
+ if (in==out){
+ int N=n;
+ t_float *dummy=x->blockbuffer;
+ while(n--)*dummy++=*in++;
+ dummy--;
+ while(N--)*out++=*dummy--;
+ } else {
+ in+=n-1;
+ while(n--)*out++=*in--;
+ }
+ } else while (n--) *out++ = *in++;
+ return (w+5);
+}
+
+static void blockmirror_dsp(t_blockmirror *x, t_signal **sp)
+{
+ if (x->blocksize<sp[0]->s_n){
+ if(x->blockbuffer)freebytes(x->blockbuffer, sizeof(t_float)*x->blocksize);
+ x->blocksize = sp[0]->s_n;
+ x->blockbuffer = getbytes(sizeof(t_float)*x->blocksize);
+ }
+ dsp_add(blockmirror_perform, 4, x, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n);
+}
+
+static void blockmirror_helper(void)
+{
+ post("\n%c blockmirror~-object for reverting a signal", HEARTSYMBOL);
+ post("'help' : view this\n"
+ "signal~");
+ post("outlet : signal~");
+}
+
+static void *blockmirror_new()
+{
+ t_blockmirror *x = (t_blockmirror *)pd_new(blockmirror_class);
+ outlet_new(&x->x_obj, gensym("signal"));
+ x->doit = 1;
+ x->blocksize=0;
+ return (x);
+}
+
+void blockmirror_tilde_setup(void)
+{
+ blockmirror_class = class_new(gensym("blockmirror~"), (t_newmethod)blockmirror_new, 0,
+ sizeof(t_blockmirror), 0, A_DEFFLOAT, 0);
+ class_addmethod(blockmirror_class, nullfn, gensym("signal"), 0);
+ class_addmethod(blockmirror_class, (t_method)blockmirror_dsp, gensym("dsp"), 0);
+
+ class_addfloat(blockmirror_class, blockmirror_float);
+
+ class_addmethod(blockmirror_class, (t_method)blockmirror_helper, gensym("help"), 0);
+ class_sethelpsymbol(blockmirror_class, gensym("zexy/blockmirror~"));
+ zexy_register("blockmirror~");
+}
diff --git a/src/blockswap_tilde.c b/src/blockswap_tilde.c
new file mode 100644
index 0000000..8c323fb
--- /dev/null
+++ b/src/blockswap_tilde.c
@@ -0,0 +1,99 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
+#include "zexy.h"
+
+/* ------------------------ blockswap~ ----------------------------- */
+
+/* swaps a signalblock around it's center:
+ {x[0], x[1], ... x[n-1]} --> {x[n-1], x[n-2], ... x[0]}
+*/
+
+static t_class *blockswap_class;
+
+typedef struct _blockswap
+{
+ t_object x_obj;
+ int doit;
+ int blocksize;
+ t_float *blockbuffer;
+} t_blockswap;
+
+static void blockswap_float(t_blockswap *x, t_floatarg f)
+{
+ x->doit = (f != 0);
+}
+
+static t_int *blockswap_perform(t_int *w)
+{
+ t_blockswap *x = (t_blockswap *)(w[1]);
+ t_float *in = (t_float *)(w[2]);
+ t_float *out = (t_float *)(w[3]);
+ int N = (int)(w[4]);
+ int N2=N/2;
+ if (x->doit) {
+ int n=N2;
+ t_float *dummy=x->blockbuffer;
+ while(n--)*dummy++=*in++;
+ n=N-N2;
+ while(n--)*out++=*in++;
+ dummy=x->blockbuffer;
+ n=N2;
+ while(n--)*out++=*dummy++;
+ } else while (N--) *out++=*in++;
+ return (w+5);
+}
+
+static void blockswap_dsp(t_blockswap *x, t_signal **sp)
+{
+ if (x->blocksize*2<sp[0]->s_n){
+ if(x->blockbuffer)freebytes(x->blockbuffer, sizeof(t_float)*x->blocksize);
+ x->blocksize = sp[0]->s_n/2;
+ x->blockbuffer = getbytes(sizeof(t_float)*x->blocksize);
+ }
+ dsp_add(blockswap_perform, 4, x, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n);
+}
+
+static void blockswap_helper(void)
+{
+ post("\n%c blockswap~-object for blockwise-swapping of a signal ", HEARTSYMBOL);
+ post("'help' : view this\n"
+ "signal~");
+ post("outlet : signal~");
+}
+
+static void *blockswap_new()
+{
+ t_blockswap *x = (t_blockswap *)pd_new(blockswap_class);
+ outlet_new(&x->x_obj, gensym("signal"));
+ x->doit = 1;
+ x->blocksize=0;
+ return (x);
+}
+
+void blockswap_tilde_setup(void)
+{
+ blockswap_class = class_new(gensym("blockswap~"), (t_newmethod)blockswap_new, 0,
+ sizeof(t_blockswap), 0, A_DEFFLOAT, 0);
+ class_addmethod(blockswap_class, nullfn, gensym("signal"), 0);
+ class_addmethod(blockswap_class, (t_method)blockswap_dsp, gensym("dsp"), 0);
+
+ class_addfloat(blockswap_class, blockswap_float);
+
+ class_addmethod(blockswap_class, (t_method)blockswap_helper, gensym("help"), 0);
+ class_sethelpsymbol(blockswap_class, gensym("zexy/blockswap~"));
+ zexy_register("blockswap~");
+}
diff --git a/src/configure b/src/configure
deleted file mode 100755
index 1dffe74..0000000
--- a/src/configure
+++ /dev/null
@@ -1,4724 +0,0 @@
-#! /bin/sh
-# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.59.
-#
-# Copyright (C) 2003 Free Software Foundation, Inc.
-# This configure script is free software; the Free Software Foundation
-# gives unlimited permission to copy, distribute and modify it.
-## --------------------- ##
-## M4sh Initialization. ##
-## --------------------- ##
-
-# Be Bourne compatible
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
- emulate sh
- NULLCMD=:
- # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
- # is contrary to our usage. Disable this feature.
- alias -g '${1+"$@"}'='"$@"'
-elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
- set -o posix
-fi
-DUALCASE=1; export DUALCASE # for MKS sh
-
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
- as_unset=unset
-else
- as_unset=false
-fi
-
-
-# Work around bugs in pre-3.0 UWIN ksh.
-$as_unset ENV MAIL MAILPATH
-PS1='$ '
-PS2='> '
-PS4='+ '
-
-# NLS nuisances.
-for as_var in \
- LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
- LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
- LC_TELEPHONE LC_TIME
-do
- if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
- eval $as_var=C; export $as_var
- else
- $as_unset $as_var
- fi
-done
-
-# Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1; then
- as_expr=expr
-else
- as_expr=false
-fi
-
-if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
- as_basename=basename
-else
- as_basename=false
-fi
-
-
-# Name of the executable.
-as_me=`$as_basename "$0" ||
-$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
- X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)$' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X/"$0" |
- sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
- /^X\/\(\/\/\)$/{ s//\1/; q; }
- /^X\/\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
-
-
-# PATH needs CR, and LINENO needs CR and PATH.
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
- echo "#! /bin/sh" >conf$$.sh
- echo "exit 0" >>conf$$.sh
- chmod +x conf$$.sh
- if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
- PATH_SEPARATOR=';'
- else
- PATH_SEPARATOR=:
- fi
- rm -f conf$$.sh
-fi
-
-
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x$as_lineno_3" = "x$as_lineno_2" || {
- # Find who we are. Look in the path if we contain no path at all
- # relative or not.
- case $0 in
- *[\\/]* ) as_myself=$0 ;;
- *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
-
- ;;
- esac
- # We did not find ourselves, most probably we were run as `sh COMMAND'
- # in which case we are not to be found in the path.
- if test "x$as_myself" = x; then
- as_myself=$0
- fi
- if test ! -f "$as_myself"; then
- { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
- { (exit 1); exit 1; }; }
- fi
- case $CONFIG_SHELL in
- '')
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for as_base in sh bash ksh sh5; do
- case $as_dir in
- /*)
- if ("$as_dir/$as_base" -c '
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
- $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
- $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
- CONFIG_SHELL=$as_dir/$as_base
- export CONFIG_SHELL
- exec "$CONFIG_SHELL" "$0" ${1+"$@"}
- fi;;
- esac
- done
-done
-;;
- esac
-
- # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
- # uniformly replaced by the line number. The first 'sed' inserts a
- # line-number line before each line; the second 'sed' does the real
- # work. The second script uses 'N' to pair each line-number line
- # with the numbered line, and appends trailing '-' during
- # substitution so that $LINENO is not a special case at line end.
- # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
- # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
- sed '=' <$as_myself |
- sed '
- N
- s,$,-,
- : loop
- s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
- t loop
- s,-$,,
- s,^['$as_cr_digits']*\n,,
- ' >$as_me.lineno &&
- chmod +x $as_me.lineno ||
- { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
- { (exit 1); exit 1; }; }
-
- # Don't try to exec as it changes $[0], causing all sort of problems
- # (the dirname of $[0] is not the place where we might find the
- # original and so on. Autoconf is especially sensible to this).
- . ./$as_me.lineno
- # Exit status is that of the last command.
- exit
-}
-
-
-case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
- *c*,-n*) ECHO_N= ECHO_C='
-' ECHO_T=' ' ;;
- *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
- *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
-esac
-
-if expr a : '\(a\)' >/dev/null 2>&1; then
- as_expr=expr
-else
- as_expr=false
-fi
-
-rm -f conf$$ conf$$.exe conf$$.file
-echo >conf$$.file
-if ln -s conf$$.file conf$$ 2>/dev/null; then
- # We could just check for DJGPP; but this test a) works b) is more generic
- # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
- if test -f conf$$.exe; then
- # Don't use ln at all; we don't have any links
- as_ln_s='cp -p'
- else
- as_ln_s='ln -s'
- fi
-elif ln conf$$.file conf$$ 2>/dev/null; then
- as_ln_s=ln
-else
- as_ln_s='cp -p'
-fi
-rm -f conf$$ conf$$.exe conf$$.file
-
-if mkdir -p . 2>/dev/null; then
- as_mkdir_p=:
-else
- test -d ./-p && rmdir ./-p
- as_mkdir_p=false
-fi
-
-as_executable_p="test -f"
-
-# Sed expression to map a string onto a valid CPP name.
-as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
-
-# Sed expression to map a string onto a valid variable name.
-as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
-
-
-# IFS
-# We need space, tab and new line, in precisely that order.
-as_nl='
-'
-IFS=" $as_nl"
-
-# CDPATH.
-$as_unset CDPATH
-
-
-# Name of the host.
-# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
-# so uname gets run too.
-ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
-
-exec 6>&1
-
-#
-# Initializations.
-#
-ac_default_prefix=/usr/local
-ac_config_libobj_dir=.
-cross_compiling=no
-subdirs=
-MFLAGS=
-MAKEFLAGS=
-SHELL=${CONFIG_SHELL-/bin/sh}
-
-# Maximum number of lines to put in a shell here document.
-# This variable seems obsolete. It should probably be removed, and
-# only ac_max_sed_lines should be used.
-: ${ac_max_here_lines=38}
-
-# Identity of this package.
-PACKAGE_NAME=
-PACKAGE_TARNAME=
-PACKAGE_VERSION=
-PACKAGE_STRING=
-PACKAGE_BUGREPORT=
-
-ac_unique_file="zexy.c"
-# Factoring default headers for most tests.
-ac_includes_default="\
-#include <stdio.h>
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-#if STDC_HEADERS
-# include <stdlib.h>
-# include <stddef.h>
-#else
-# if HAVE_STDLIB_H
-# include <stdlib.h>
-# endif
-#endif
-#if HAVE_STRING_H
-# if !STDC_HEADERS && HAVE_MEMORY_H
-# include <memory.h>
-# endif
-# include <string.h>
-#endif
-#if HAVE_STRINGS_H
-# include <strings.h>
-#endif
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-# include <stdint.h>
-# endif
-#endif
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif"
-
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT STK DFLAGS LFLAGS EXT LD STRIPFLAGS ZEXY_VERSION REFERENCEPATH PDLIBDIR INCLUDES SOURCES CPP EGREP LIBOBJS LTLIBOBJS'
-ac_subst_files=''
-
-# Initialize some variables set by options.
-ac_init_help=
-ac_init_version=false
-# The variables have the same names as the options, with
-# dashes changed to underlines.
-cache_file=/dev/null
-exec_prefix=NONE
-no_create=
-no_recursion=
-prefix=NONE
-program_prefix=NONE
-program_suffix=NONE
-program_transform_name=s,x,x,
-silent=
-site=
-srcdir=
-verbose=
-x_includes=NONE
-x_libraries=NONE
-
-# Installation directory options.
-# These are left unexpanded so users can "make install exec_prefix=/foo"
-# and all the variables that are supposed to be based on exec_prefix
-# by default will actually change.
-# Use braces instead of parens because sh, perl, etc. also accept them.
-bindir='${exec_prefix}/bin'
-sbindir='${exec_prefix}/sbin'
-libexecdir='${exec_prefix}/libexec'
-datadir='${prefix}/share'
-sysconfdir='${prefix}/etc'
-sharedstatedir='${prefix}/com'
-localstatedir='${prefix}/var'
-libdir='${exec_prefix}/lib'
-includedir='${prefix}/include'
-oldincludedir='/usr/include'
-infodir='${prefix}/info'
-mandir='${prefix}/man'
-
-ac_prev=
-for ac_option
-do
- # If the previous option needs an argument, assign it.
- if test -n "$ac_prev"; then
- eval "$ac_prev=\$ac_option"
- ac_prev=
- continue
- fi
-
- ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
-
- # Accept the important Cygnus configure options, so we can diagnose typos.
-
- case $ac_option in
-
- -bindir | --bindir | --bindi | --bind | --bin | --bi)
- ac_prev=bindir ;;
- -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
- bindir=$ac_optarg ;;
-
- -build | --build | --buil | --bui | --bu)
- ac_prev=build_alias ;;
- -build=* | --build=* | --buil=* | --bui=* | --bu=*)
- build_alias=$ac_optarg ;;
-
- -cache-file | --cache-file | --cache-fil | --cache-fi \
- | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
- ac_prev=cache_file ;;
- -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
- | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
- cache_file=$ac_optarg ;;
-
- --config-cache | -C)
- cache_file=config.cache ;;
-
- -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
- ac_prev=datadir ;;
- -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
- | --da=*)
- datadir=$ac_optarg ;;
-
- -disable-* | --disable-*)
- ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
- # Reject names that are not valid shell variable names.
- expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
- { echo "$as_me: error: invalid feature name: $ac_feature" >&2
- { (exit 1); exit 1; }; }
- ac_feature=`echo $ac_feature | sed 's/-/_/g'`
- eval "enable_$ac_feature=no" ;;
-
- -enable-* | --enable-*)
- ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
- # Reject names that are not valid shell variable names.
- expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
- { echo "$as_me: error: invalid feature name: $ac_feature" >&2
- { (exit 1); exit 1; }; }
- ac_feature=`echo $ac_feature | sed 's/-/_/g'`
- case $ac_option in
- *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
- *) ac_optarg=yes ;;
- esac
- eval "enable_$ac_feature='$ac_optarg'" ;;
-
- -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
- | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
- | --exec | --exe | --ex)
- ac_prev=exec_prefix ;;
- -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
- | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
- | --exec=* | --exe=* | --ex=*)
- exec_prefix=$ac_optarg ;;
-
- -gas | --gas | --ga | --g)
- # Obsolete; use --with-gas.
- with_gas=yes ;;
-
- -help | --help | --hel | --he | -h)
- ac_init_help=long ;;
- -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
- ac_init_help=recursive ;;
- -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
- ac_init_help=short ;;
-
- -host | --host | --hos | --ho)
- ac_prev=host_alias ;;
- -host=* | --host=* | --hos=* | --ho=*)
- host_alias=$ac_optarg ;;
-
- -includedir | --includedir | --includedi | --included | --include \
- | --includ | --inclu | --incl | --inc)
- ac_prev=includedir ;;
- -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
- | --includ=* | --inclu=* | --incl=* | --inc=*)
- includedir=$ac_optarg ;;
-
- -infodir | --infodir | --infodi | --infod | --info | --inf)
- ac_prev=infodir ;;
- -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
- infodir=$ac_optarg ;;
-
- -libdir | --libdir | --libdi | --libd)
- ac_prev=libdir ;;
- -libdir=* | --libdir=* | --libdi=* | --libd=*)
- libdir=$ac_optarg ;;
-
- -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
- | --libexe | --libex | --libe)
- ac_prev=libexecdir ;;
- -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
- | --libexe=* | --libex=* | --libe=*)
- libexecdir=$ac_optarg ;;
-
- -localstatedir | --localstatedir | --localstatedi | --localstated \
- | --localstate | --localstat | --localsta | --localst \
- | --locals | --local | --loca | --loc | --lo)
- ac_prev=localstatedir ;;
- -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
- | --localstate=* | --localstat=* | --localsta=* | --localst=* \
- | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
- localstatedir=$ac_optarg ;;
-
- -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
- ac_prev=mandir ;;
- -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
- mandir=$ac_optarg ;;
-
- -nfp | --nfp | --nf)
- # Obsolete; use --without-fp.
- with_fp=no ;;
-
- -no-create | --no-create | --no-creat | --no-crea | --no-cre \
- | --no-cr | --no-c | -n)
- no_create=yes ;;
-
- -no-recursion | --no-recursion | --no-recursio | --no-recursi \
- | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
- no_recursion=yes ;;
-
- -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
- | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
- | --oldin | --oldi | --old | --ol | --o)
- ac_prev=oldincludedir ;;
- -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
- | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
- | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
- oldincludedir=$ac_optarg ;;
-
- -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
- ac_prev=prefix ;;
- -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
- prefix=$ac_optarg ;;
-
- -program-prefix | --program-prefix | --program-prefi | --program-pref \
- | --program-pre | --program-pr | --program-p)
- ac_prev=program_prefix ;;
- -program-prefix=* | --program-prefix=* | --program-prefi=* \
- | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
- program_prefix=$ac_optarg ;;
-
- -program-suffix | --program-suffix | --program-suffi | --program-suff \
- | --program-suf | --program-su | --program-s)
- ac_prev=program_suffix ;;
- -program-suffix=* | --program-suffix=* | --program-suffi=* \
- | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
- program_suffix=$ac_optarg ;;
-
- -program-transform-name | --program-transform-name \
- | --program-transform-nam | --program-transform-na \
- | --program-transform-n | --program-transform- \
- | --program-transform | --program-transfor \
- | --program-transfo | --program-transf \
- | --program-trans | --program-tran \
- | --progr-tra | --program-tr | --program-t)
- ac_prev=program_transform_name ;;
- -program-transform-name=* | --program-transform-name=* \
- | --program-transform-nam=* | --program-transform-na=* \
- | --program-transform-n=* | --program-transform-=* \
- | --program-transform=* | --program-transfor=* \
- | --program-transfo=* | --program-transf=* \
- | --program-trans=* | --program-tran=* \
- | --progr-tra=* | --program-tr=* | --program-t=*)
- program_transform_name=$ac_optarg ;;
-
- -q | -quiet | --quiet | --quie | --qui | --qu | --q \
- | -silent | --silent | --silen | --sile | --sil)
- silent=yes ;;
-
- -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
- ac_prev=sbindir ;;
- -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
- | --sbi=* | --sb=*)
- sbindir=$ac_optarg ;;
-
- -sharedstatedir | --sharedstatedir | --sharedstatedi \
- | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
- | --sharedst | --shareds | --shared | --share | --shar \
- | --sha | --sh)
- ac_prev=sharedstatedir ;;
- -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
- | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
- | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
- | --sha=* | --sh=*)
- sharedstatedir=$ac_optarg ;;
-
- -site | --site | --sit)
- ac_prev=site ;;
- -site=* | --site=* | --sit=*)
- site=$ac_optarg ;;
-
- -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
- ac_prev=srcdir ;;
- -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
- srcdir=$ac_optarg ;;
-
- -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
- | --syscon | --sysco | --sysc | --sys | --sy)
- ac_prev=sysconfdir ;;
- -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
- | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
- sysconfdir=$ac_optarg ;;
-
- -target | --target | --targe | --targ | --tar | --ta | --t)
- ac_prev=target_alias ;;
- -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
- target_alias=$ac_optarg ;;
-
- -v | -verbose | --verbose | --verbos | --verbo | --verb)
- verbose=yes ;;
-
- -version | --version | --versio | --versi | --vers | -V)
- ac_init_version=: ;;
-
- -with-* | --with-*)
- ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
- # Reject names that are not valid shell variable names.
- expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
- { echo "$as_me: error: invalid package name: $ac_package" >&2
- { (exit 1); exit 1; }; }
- ac_package=`echo $ac_package| sed 's/-/_/g'`
- case $ac_option in
- *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
- *) ac_optarg=yes ;;
- esac
- eval "with_$ac_package='$ac_optarg'" ;;
-
- -without-* | --without-*)
- ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
- # Reject names that are not valid shell variable names.
- expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
- { echo "$as_me: error: invalid package name: $ac_package" >&2
- { (exit 1); exit 1; }; }
- ac_package=`echo $ac_package | sed 's/-/_/g'`
- eval "with_$ac_package=no" ;;
-
- --x)
- # Obsolete; use --with-x.
- with_x=yes ;;
-
- -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
- | --x-incl | --x-inc | --x-in | --x-i)
- ac_prev=x_includes ;;
- -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
- | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
- x_includes=$ac_optarg ;;
-
- -x-libraries | --x-libraries | --x-librarie | --x-librari \
- | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
- ac_prev=x_libraries ;;
- -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
- | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
- x_libraries=$ac_optarg ;;
-
- -*) { echo "$as_me: error: unrecognized option: $ac_option
-Try \`$0 --help' for more information." >&2
- { (exit 1); exit 1; }; }
- ;;
-
- *=*)
- ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
- # Reject names that are not valid shell variable names.
- expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
- { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
- { (exit 1); exit 1; }; }
- ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
- eval "$ac_envvar='$ac_optarg'"
- export $ac_envvar ;;
-
- *)
- # FIXME: should be removed in autoconf 3.0.
- echo "$as_me: WARNING: you should use --build, --host, --target" >&2
- expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
- echo "$as_me: WARNING: invalid host type: $ac_option" >&2
- : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
- ;;
-
- esac
-done
-
-if test -n "$ac_prev"; then
- ac_option=--`echo $ac_prev | sed 's/_/-/g'`
- { echo "$as_me: error: missing argument to $ac_option" >&2
- { (exit 1); exit 1; }; }
-fi
-
-# Be sure to have absolute paths.
-for ac_var in exec_prefix prefix
-do
- eval ac_val=$`echo $ac_var`
- case $ac_val in
- [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
- *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
- { (exit 1); exit 1; }; };;
- esac
-done
-
-# Be sure to have absolute paths.
-for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
- localstatedir libdir includedir oldincludedir infodir mandir
-do
- eval ac_val=$`echo $ac_var`
- case $ac_val in
- [\\/$]* | ?:[\\/]* ) ;;
- *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
- { (exit 1); exit 1; }; };;
- esac
-done
-
-# There might be people who depend on the old broken behavior: `$host'
-# used to hold the argument of --host etc.
-# FIXME: To remove some day.
-build=$build_alias
-host=$host_alias
-target=$target_alias
-
-# FIXME: To remove some day.
-if test "x$host_alias" != x; then
- if test "x$build_alias" = x; then
- cross_compiling=maybe
- echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
- If a cross compiler is detected then cross compile mode will be used." >&2
- elif test "x$build_alias" != "x$host_alias"; then
- cross_compiling=yes
- fi
-fi
-
-ac_tool_prefix=
-test -n "$host_alias" && ac_tool_prefix=$host_alias-
-
-test "$silent" = yes && exec 6>/dev/null
-
-
-# Find the source files, if location was not specified.
-if test -z "$srcdir"; then
- ac_srcdir_defaulted=yes
- # Try the directory containing this script, then its parent.
- ac_confdir=`(dirname "$0") 2>/dev/null ||
-$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$0" : 'X\(//\)[^/]' \| \
- X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X"$0" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
- srcdir=$ac_confdir
- if test ! -r $srcdir/$ac_unique_file; then
- srcdir=..
- fi
-else
- ac_srcdir_defaulted=no
-fi
-if test ! -r $srcdir/$ac_unique_file; then
- if test "$ac_srcdir_defaulted" = yes; then
- { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
- { (exit 1); exit 1; }; }
- else
- { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
- { (exit 1); exit 1; }; }
- fi
-fi
-(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
- { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
- { (exit 1); exit 1; }; }
-srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
-ac_env_build_alias_set=${build_alias+set}
-ac_env_build_alias_value=$build_alias
-ac_cv_env_build_alias_set=${build_alias+set}
-ac_cv_env_build_alias_value=$build_alias
-ac_env_host_alias_set=${host_alias+set}
-ac_env_host_alias_value=$host_alias
-ac_cv_env_host_alias_set=${host_alias+set}
-ac_cv_env_host_alias_value=$host_alias
-ac_env_target_alias_set=${target_alias+set}
-ac_env_target_alias_value=$target_alias
-ac_cv_env_target_alias_set=${target_alias+set}
-ac_cv_env_target_alias_value=$target_alias
-ac_env_CC_set=${CC+set}
-ac_env_CC_value=$CC
-ac_cv_env_CC_set=${CC+set}
-ac_cv_env_CC_value=$CC
-ac_env_CFLAGS_set=${CFLAGS+set}
-ac_env_CFLAGS_value=$CFLAGS
-ac_cv_env_CFLAGS_set=${CFLAGS+set}
-ac_cv_env_CFLAGS_value=$CFLAGS
-ac_env_LDFLAGS_set=${LDFLAGS+set}
-ac_env_LDFLAGS_value=$LDFLAGS
-ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
-ac_cv_env_LDFLAGS_value=$LDFLAGS
-ac_env_CPPFLAGS_set=${CPPFLAGS+set}
-ac_env_CPPFLAGS_value=$CPPFLAGS
-ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
-ac_cv_env_CPPFLAGS_value=$CPPFLAGS
-ac_env_CPP_set=${CPP+set}
-ac_env_CPP_value=$CPP
-ac_cv_env_CPP_set=${CPP+set}
-ac_cv_env_CPP_value=$CPP
-
-#
-# Report the --help message.
-#
-if test "$ac_init_help" = "long"; then
- # Omit some internal or obsolete options to make the list less imposing.
- # This message is too long to be a string in the A/UX 3.1 sh.
- cat <<_ACEOF
-\`configure' configures this package to adapt to many kinds of systems.
-
-Usage: $0 [OPTION]... [VAR=VALUE]...
-
-To assign environment variables (e.g., CC, CFLAGS...), specify them as
-VAR=VALUE. See below for descriptions of some of the useful variables.
-
-Defaults for the options are specified in brackets.
-
-Configuration:
- -h, --help display this help and exit
- --help=short display options specific to this package
- --help=recursive display the short help of all the included packages
- -V, --version display version information and exit
- -q, --quiet, --silent do not print \`checking...' messages
- --cache-file=FILE cache test results in FILE [disabled]
- -C, --config-cache alias for \`--cache-file=config.cache'
- -n, --no-create do not create output files
- --srcdir=DIR find the sources in DIR [configure dir or \`..']
-
-_ACEOF
-
- cat <<_ACEOF
-Installation directories:
- --prefix=PREFIX install architecture-independent files in PREFIX
- [$ac_default_prefix]
- --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
- [PREFIX]
-
-By default, \`make install' will install all the files in
-\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
-an installation prefix other than \`$ac_default_prefix' using \`--prefix',
-for instance \`--prefix=\$HOME'.
-
-For better control, use the options below.
-
-Fine tuning of the installation directories:
- --bindir=DIR user executables [EPREFIX/bin]
- --sbindir=DIR system admin executables [EPREFIX/sbin]
- --libexecdir=DIR program executables [EPREFIX/libexec]
- --datadir=DIR read-only architecture-independent data [PREFIX/share]
- --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
- --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
- --localstatedir=DIR modifiable single-machine data [PREFIX/var]
- --libdir=DIR object code libraries [EPREFIX/lib]
- --includedir=DIR C header files [PREFIX/include]
- --oldincludedir=DIR C header files for non-gcc [/usr/include]
- --infodir=DIR info documentation [PREFIX/info]
- --mandir=DIR man documentation [PREFIX/man]
-_ACEOF
-
- cat <<\_ACEOF
-_ACEOF
-fi
-
-if test -n "$ac_init_help"; then
-
- cat <<\_ACEOF
-
-Optional Features:
- --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
- --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
- --enable-lpt enable parallelport-support
-
-Optional Packages:
- --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
- --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
- --with-pdversion=<ver> enforce a certain pd-version (e.g. 0.37)
-
-Some influential environment variables:
- CC C compiler command
- CFLAGS C compiler flags
- LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
- nonstandard directory <lib dir>
- CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have
- headers in a nonstandard directory <include dir>
- CPP C preprocessor
-
-Use these variables to override the choices made by `configure' or to help
-it to find libraries and programs with nonstandard names/locations.
-
-_ACEOF
-fi
-
-if test "$ac_init_help" = "recursive"; then
- # If there are subdirs, report their specific --help.
- ac_popdir=`pwd`
- for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
- test -d $ac_dir || continue
- ac_builddir=.
-
-if test "$ac_dir" != .; then
- ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
- # A "../" for each directory in $ac_dir_suffix.
- ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
-else
- ac_dir_suffix= ac_top_builddir=
-fi
-
-case $srcdir in
- .) # No --srcdir option. We are building in place.
- ac_srcdir=.
- if test -z "$ac_top_builddir"; then
- ac_top_srcdir=.
- else
- ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
- fi ;;
- [\\/]* | ?:[\\/]* ) # Absolute path.
- ac_srcdir=$srcdir$ac_dir_suffix;
- ac_top_srcdir=$srcdir ;;
- *) # Relative path.
- ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
- ac_top_srcdir=$ac_top_builddir$srcdir ;;
-esac
-
-# Do not use `cd foo && pwd` to compute absolute paths, because
-# the directories may not exist.
-case `pwd` in
-.) ac_abs_builddir="$ac_dir";;
-*)
- case "$ac_dir" in
- .) ac_abs_builddir=`pwd`;;
- [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
- *) ac_abs_builddir=`pwd`/"$ac_dir";;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_builddir=${ac_top_builddir}.;;
-*)
- case ${ac_top_builddir}. in
- .) ac_abs_top_builddir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
- *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_srcdir=$ac_srcdir;;
-*)
- case $ac_srcdir in
- .) ac_abs_srcdir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
- *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_srcdir=$ac_top_srcdir;;
-*)
- case $ac_top_srcdir in
- .) ac_abs_top_srcdir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
- *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
- esac;;
-esac
-
- cd $ac_dir
- # Check for guested configure; otherwise get Cygnus style configure.
- if test -f $ac_srcdir/configure.gnu; then
- echo
- $SHELL $ac_srcdir/configure.gnu --help=recursive
- elif test -f $ac_srcdir/configure; then
- echo
- $SHELL $ac_srcdir/configure --help=recursive
- elif test -f $ac_srcdir/configure.ac ||
- test -f $ac_srcdir/configure.in; then
- echo
- $ac_configure --help
- else
- echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
- fi
- cd "$ac_popdir"
- done
-fi
-
-test -n "$ac_init_help" && exit 0
-if $ac_init_version; then
- cat <<\_ACEOF
-
-Copyright (C) 2003 Free Software Foundation, Inc.
-This configure script is free software; the Free Software Foundation
-gives unlimited permission to copy, distribute and modify it.
-_ACEOF
- exit 0
-fi
-exec 5>config.log
-cat >&5 <<_ACEOF
-This file contains any messages produced by compilers while
-running configure, to aid debugging if configure makes a mistake.
-
-It was created by $as_me, which was
-generated by GNU Autoconf 2.59. Invocation command line was
-
- $ $0 $@
-
-_ACEOF
-{
-cat <<_ASUNAME
-## --------- ##
-## Platform. ##
-## --------- ##
-
-hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
-uname -m = `(uname -m) 2>/dev/null || echo unknown`
-uname -r = `(uname -r) 2>/dev/null || echo unknown`
-uname -s = `(uname -s) 2>/dev/null || echo unknown`
-uname -v = `(uname -v) 2>/dev/null || echo unknown`
-
-/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
-/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
-
-/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
-/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
-/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
-hostinfo = `(hostinfo) 2>/dev/null || echo unknown`
-/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
-/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
-/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
-
-_ASUNAME
-
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- echo "PATH: $as_dir"
-done
-
-} >&5
-
-cat >&5 <<_ACEOF
-
-
-## ----------- ##
-## Core tests. ##
-## ----------- ##
-
-_ACEOF
-
-
-# Keep a trace of the command line.
-# Strip out --no-create and --no-recursion so they do not pile up.
-# Strip out --silent because we don't want to record it for future runs.
-# Also quote any args containing shell meta-characters.
-# Make two passes to allow for proper duplicate-argument suppression.
-ac_configure_args=
-ac_configure_args0=
-ac_configure_args1=
-ac_sep=
-ac_must_keep_next=false
-for ac_pass in 1 2
-do
- for ac_arg
- do
- case $ac_arg in
- -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
- -q | -quiet | --quiet | --quie | --qui | --qu | --q \
- | -silent | --silent | --silen | --sile | --sil)
- continue ;;
- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
- ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
- esac
- case $ac_pass in
- 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
- 2)
- ac_configure_args1="$ac_configure_args1 '$ac_arg'"
- if test $ac_must_keep_next = true; then
- ac_must_keep_next=false # Got value, back to normal.
- else
- case $ac_arg in
- *=* | --config-cache | -C | -disable-* | --disable-* \
- | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
- | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
- | -with-* | --with-* | -without-* | --without-* | --x)
- case "$ac_configure_args0 " in
- "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
- esac
- ;;
- -* ) ac_must_keep_next=true ;;
- esac
- fi
- ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
- # Get rid of the leading space.
- ac_sep=" "
- ;;
- esac
- done
-done
-$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
-$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
-
-# When interrupted or exit'd, cleanup temporary files, and complete
-# config.log. We remove comments because anyway the quotes in there
-# would cause problems or look ugly.
-# WARNING: Be sure not to use single quotes in there, as some shells,
-# such as our DU 5.0 friend, will then `close' the trap.
-trap 'exit_status=$?
- # Save into config.log some information that might help in debugging.
- {
- echo
-
- cat <<\_ASBOX
-## ---------------- ##
-## Cache variables. ##
-## ---------------- ##
-_ASBOX
- echo
- # The following way of writing the cache mishandles newlines in values,
-{
- (set) 2>&1 |
- case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
- *ac_space=\ *)
- sed -n \
- "s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
- s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
- ;;
- *)
- sed -n \
- "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
- ;;
- esac;
-}
- echo
-
- cat <<\_ASBOX
-## ----------------- ##
-## Output variables. ##
-## ----------------- ##
-_ASBOX
- echo
- for ac_var in $ac_subst_vars
- do
- eval ac_val=$`echo $ac_var`
- echo "$ac_var='"'"'$ac_val'"'"'"
- done | sort
- echo
-
- if test -n "$ac_subst_files"; then
- cat <<\_ASBOX
-## ------------- ##
-## Output files. ##
-## ------------- ##
-_ASBOX
- echo
- for ac_var in $ac_subst_files
- do
- eval ac_val=$`echo $ac_var`
- echo "$ac_var='"'"'$ac_val'"'"'"
- done | sort
- echo
- fi
-
- if test -s confdefs.h; then
- cat <<\_ASBOX
-## ----------- ##
-## confdefs.h. ##
-## ----------- ##
-_ASBOX
- echo
- sed "/^$/d" confdefs.h | sort
- echo
- fi
- test "$ac_signal" != 0 &&
- echo "$as_me: caught signal $ac_signal"
- echo "$as_me: exit $exit_status"
- } >&5
- rm -f core *.core &&
- rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
- exit $exit_status
- ' 0
-for ac_signal in 1 2 13 15; do
- trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
-done
-ac_signal=0
-
-# confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -rf conftest* confdefs.h
-# AIX cpp loses on an empty file, so make sure it contains at least a newline.
-echo >confdefs.h
-
-# Predefined preprocessor variables.
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_NAME "$PACKAGE_NAME"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_VERSION "$PACKAGE_VERSION"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_STRING "$PACKAGE_STRING"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
-_ACEOF
-
-
-# Let the site file select an alternate cache file if it wants to.
-# Prefer explicitly selected file to automatically selected ones.
-if test -z "$CONFIG_SITE"; then
- if test "x$prefix" != xNONE; then
- CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
- else
- CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
- fi
-fi
-for ac_site_file in $CONFIG_SITE; do
- if test -r "$ac_site_file"; then
- { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
-echo "$as_me: loading site script $ac_site_file" >&6;}
- sed 's/^/| /' "$ac_site_file" >&5
- . "$ac_site_file"
- fi
-done
-
-if test -r "$cache_file"; then
- # Some versions of bash will fail to source /dev/null (special
- # files actually), so we avoid doing that.
- if test -f "$cache_file"; then
- { echo "$as_me:$LINENO: loading cache $cache_file" >&5
-echo "$as_me: loading cache $cache_file" >&6;}
- case $cache_file in
- [\\/]* | ?:[\\/]* ) . $cache_file;;
- *) . ./$cache_file;;
- esac
- fi
-else
- { echo "$as_me:$LINENO: creating cache $cache_file" >&5
-echo "$as_me: creating cache $cache_file" >&6;}
- >$cache_file
-fi
-
-# Check that the precious variables saved in the cache have kept the same
-# value.
-ac_cache_corrupted=false
-for ac_var in `(set) 2>&1 |
- sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
- eval ac_old_set=\$ac_cv_env_${ac_var}_set
- eval ac_new_set=\$ac_env_${ac_var}_set
- eval ac_old_val="\$ac_cv_env_${ac_var}_value"
- eval ac_new_val="\$ac_env_${ac_var}_value"
- case $ac_old_set,$ac_new_set in
- set,)
- { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
-echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
- ac_cache_corrupted=: ;;
- ,set)
- { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
-echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
- ac_cache_corrupted=: ;;
- ,);;
- *)
- if test "x$ac_old_val" != "x$ac_new_val"; then
- { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
-echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
- { echo "$as_me:$LINENO: former value: $ac_old_val" >&5
-echo "$as_me: former value: $ac_old_val" >&2;}
- { echo "$as_me:$LINENO: current value: $ac_new_val" >&5
-echo "$as_me: current value: $ac_new_val" >&2;}
- ac_cache_corrupted=:
- fi;;
- esac
- # Pass precious variables to config.status.
- if test "$ac_new_set" = set; then
- case $ac_new_val in
- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
- ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
- *) ac_arg=$ac_var=$ac_new_val ;;
- esac
- case " $ac_configure_args " in
- *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
- *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
- esac
- fi
-done
-if $ac_cache_corrupted; then
- { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
-echo "$as_me: error: changes in the environment can compromise the build" >&2;}
- { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
-echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
- { (exit 1); exit 1; }; }
-fi
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}gcc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_CC="${ac_tool_prefix}gcc"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
- echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-fi
-if test -z "$ac_cv_prog_CC"; then
- ac_ct_CC=$CC
- # Extract the first word of "gcc", so it can be a program name with args.
-set dummy gcc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$ac_ct_CC"; then
- ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_CC="gcc"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
- echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
- CC=$ac_ct_CC
-else
- CC="$ac_cv_prog_CC"
-fi
-
-if test -z "$CC"; then
- if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}cc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_CC="${ac_tool_prefix}cc"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
- echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-fi
-if test -z "$ac_cv_prog_CC"; then
- ac_ct_CC=$CC
- # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$ac_ct_CC"; then
- ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_CC="cc"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
- echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
- CC=$ac_ct_CC
-else
- CC="$ac_cv_prog_CC"
-fi
-
-fi
-if test -z "$CC"; then
- # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- ac_prog_rejected=no
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
- ac_prog_rejected=yes
- continue
- fi
- ac_cv_prog_CC="cc"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-if test $ac_prog_rejected = yes; then
- # We found a bogon in the path, so make sure we never use it.
- set dummy $ac_cv_prog_CC
- shift
- if test $# != 0; then
- # We chose a different compiler from the bogus one.
- # However, it has the same basename, so the bogon will be chosen
- # first if we set CC to just the basename; use the full file name.
- shift
- ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
- fi
-fi
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
- echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-fi
-if test -z "$CC"; then
- if test -n "$ac_tool_prefix"; then
- for ac_prog in cl
- do
- # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
-set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
- echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
- test -n "$CC" && break
- done
-fi
-if test -z "$CC"; then
- ac_ct_CC=$CC
- for ac_prog in cl
-do
- # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$ac_ct_CC"; then
- ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_CC="$ac_prog"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
- echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
- test -n "$ac_ct_CC" && break
-done
-
- CC=$ac_ct_CC
-fi
-
-fi
-
-
-test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
-See \`config.log' for more details." >&5
-echo "$as_me: error: no acceptable C compiler found in \$PATH
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
-
-# Provide some information about the compiler.
-echo "$as_me:$LINENO:" \
- "checking for C compiler version" >&5
-ac_compiler=`set X $ac_compile; echo $2`
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
- (eval $ac_compiler --version </dev/null >&5) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
- (eval $ac_compiler -v </dev/null >&5) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
- (eval $ac_compiler -V </dev/null >&5) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
-
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files a.out a.exe b.out"
-# Try to create an executable without -o first, disregard a.out.
-# It will help us diagnose broken compilers, and finding out an intuition
-# of exeext.
-echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
-echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6
-ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
-if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
- (eval $ac_link_default) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; then
- # Find the output, starting from the most likely. This scheme is
-# not robust to junk in `.', hence go to wildcards (a.*) only as a last
-# resort.
-
-# Be careful to initialize this variable, since it used to be cached.
-# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
-ac_cv_exeext=
-# b.out is created by i960 compilers.
-for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
-do
- test -f "$ac_file" || continue
- case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
- ;;
- conftest.$ac_ext )
- # This is the source file.
- ;;
- [ab].out )
- # We found the default executable, but exeext='' is most
- # certainly right.
- break;;
- *.* )
- ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
- # FIXME: I believe we export ac_cv_exeext for Libtool,
- # but it would be cool to find out if it's true. Does anybody
- # maintain Libtool? --akim.
- export ac_cv_exeext
- break;;
- * )
- break;;
- esac
-done
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
-See \`config.log' for more details." >&5
-echo "$as_me: error: C compiler cannot create executables
-See \`config.log' for more details." >&2;}
- { (exit 77); exit 77; }; }
-fi
-
-ac_exeext=$ac_cv_exeext
-echo "$as_me:$LINENO: result: $ac_file" >&5
-echo "${ECHO_T}$ac_file" >&6
-
-# Check the compiler produces executables we can run. If not, either
-# the compiler is broken, or we cross compile.
-echo "$as_me:$LINENO: checking whether the C compiler works" >&5
-echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
-# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
-# If not cross compiling, check that we can run a simple program.
-if test "$cross_compiling" != yes; then
- if { ac_try='./$ac_file'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- cross_compiling=no
- else
- if test "$cross_compiling" = maybe; then
- cross_compiling=yes
- else
- { { echo "$as_me:$LINENO: error: cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
- fi
- fi
-fi
-echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
-
-rm -f a.out a.exe conftest$ac_cv_exeext b.out
-ac_clean_files=$ac_clean_files_save
-# Check the compiler produces executables we can run. If not, either
-# the compiler is broken, or we cross compile.
-echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
-echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
-echo "$as_me:$LINENO: result: $cross_compiling" >&5
-echo "${ECHO_T}$cross_compiling" >&6
-
-echo "$as_me:$LINENO: checking for suffix of executables" >&5
-echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; then
- # If both `conftest.exe' and `conftest' are `present' (well, observable)
-# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
-# work properly (i.e., refer to `conftest.exe'), while it won't with
-# `rm'.
-for ac_file in conftest.exe conftest conftest.*; do
- test -f "$ac_file" || continue
- case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
- *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
- export ac_cv_exeext
- break;;
- * ) break;;
- esac
-done
-else
- { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
-fi
-
-rm -f conftest$ac_cv_exeext
-echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
-echo "${ECHO_T}$ac_cv_exeext" >&6
-
-rm -f conftest.$ac_ext
-EXEEXT=$ac_cv_exeext
-ac_exeext=$EXEEXT
-echo "$as_me:$LINENO: checking for suffix of object files" >&5
-echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
-if test "${ac_cv_objext+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.o conftest.obj
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; then
- for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
- case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
- *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
- break;;
- esac
-done
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
-fi
-
-rm -f conftest.$ac_cv_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
-echo "${ECHO_T}$ac_cv_objext" >&6
-OBJEXT=$ac_cv_objext
-ac_objext=$OBJEXT
-echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
-echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
-if test "${ac_cv_c_compiler_gnu+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-#ifndef __GNUC__
- choke me
-#endif
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_compiler_gnu=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_compiler_gnu=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-ac_cv_c_compiler_gnu=$ac_compiler_gnu
-
-fi
-echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
-echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
-GCC=`test $ac_compiler_gnu = yes && echo yes`
-ac_test_CFLAGS=${CFLAGS+set}
-ac_save_CFLAGS=$CFLAGS
-CFLAGS="-g"
-echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
-echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
-if test "${ac_cv_prog_cc_g+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_prog_cc_g=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_prog_cc_g=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
-if test "$ac_test_CFLAGS" = set; then
- CFLAGS=$ac_save_CFLAGS
-elif test $ac_cv_prog_cc_g = yes; then
- if test "$GCC" = yes; then
- CFLAGS="-g -O2"
- else
- CFLAGS="-g"
- fi
-else
- if test "$GCC" = yes; then
- CFLAGS="-O2"
- else
- CFLAGS=
- fi
-fi
-echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
-echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
-if test "${ac_cv_prog_cc_stdc+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_cv_prog_cc_stdc=no
-ac_save_CC=$CC
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdarg.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
-struct buf { int x; };
-FILE * (*rcsopen) (struct buf *, struct stat *, int);
-static char *e (p, i)
- char **p;
- int i;
-{
- return p[i];
-}
-static char *f (char * (*g) (char **, int), char **p, ...)
-{
- char *s;
- va_list v;
- va_start (v,p);
- s = g (p, va_arg (v,int));
- va_end (v);
- return s;
-}
-
-/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
- function prototypes and stuff, but not '\xHH' hex character constants.
- These don't provoke an error unfortunately, instead are silently treated
- as 'x'. The following induces an error, until -std1 is added to get
- proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
- array size at least. It's necessary to write '\x00'==0 to get something
- that's true only with -std1. */
-int osf4_cc_array ['\x00' == 0 ? 1 : -1];
-
-int test (int i, double x);
-struct s1 {int (*f) (int a);};
-struct s2 {int (*f) (double a);};
-int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
-int argc;
-char **argv;
-int
-main ()
-{
-return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
- ;
- return 0;
-}
-_ACEOF
-# Don't try gcc -ansi; that turns off useful extensions and
-# breaks some systems' header files.
-# AIX -qlanglvl=ansi
-# Ultrix and OSF/1 -std1
-# HP-UX 10.20 and later -Ae
-# HP-UX older versions -Aa -D_HPUX_SOURCE
-# SVR4 -Xc -D__EXTENSIONS__
-for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
-do
- CC="$ac_save_CC $ac_arg"
- rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_prog_cc_stdc=$ac_arg
-break
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-fi
-rm -f conftest.err conftest.$ac_objext
-done
-rm -f conftest.$ac_ext conftest.$ac_objext
-CC=$ac_save_CC
-
-fi
-
-case "x$ac_cv_prog_cc_stdc" in
- x|xno)
- echo "$as_me:$LINENO: result: none needed" >&5
-echo "${ECHO_T}none needed" >&6 ;;
- *)
- echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
- CC="$CC $ac_cv_prog_cc_stdc" ;;
-esac
-
-# Some people use a C++ compiler to compile C. Since we use `exit',
-# in C++ we need to declare it. In case someone uses the same compiler
-# for both compiling C and C++ we need to have the C++ compiler decide
-# the declaration of exit, since it's the most demanding environment.
-cat >conftest.$ac_ext <<_ACEOF
-#ifndef __cplusplus
- choke me
-#endif
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- for ac_declaration in \
- '' \
- 'extern "C" void std::exit (int) throw (); using std::exit;' \
- 'extern "C" void std::exit (int); using std::exit;' \
- 'extern "C" void exit (int) throw ();' \
- 'extern "C" void exit (int);' \
- 'void exit (int);'
-do
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_declaration
-#include <stdlib.h>
-int
-main ()
-{
-exit (42);
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- :
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-continue
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_declaration
-int
-main ()
-{
-exit (42);
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- break
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-rm -f conftest*
-if test -n "$ac_declaration"; then
- echo '#ifdef __cplusplus' >>confdefs.h
- echo $ac_declaration >>confdefs.h
- echo '#endif' >>confdefs.h
-fi
-
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-# Check whether --with-pdversion or --without-pdversion was given.
-if test "${with_pdversion+set}" = set; then
- withval="$with_pdversion"
-
-fi;
-# Check whether --enable-lpt or --disable-lpt was given.
-if test "${enable_lpt+set}" = set; then
- enableval="$enable_lpt"
-
-fi;
-
-if test $includedir
-then
- for id in $includedir
- do
- if test -d $id
- then
- INCLUDES="-I$id $INCLUDES"
- fi
- done
-fi
-
-
-
-echo "$as_me:$LINENO: checking for main in -lc" >&5
-echo $ECHO_N "checking for main in -lc... $ECHO_C" >&6
-if test "${ac_cv_lib_c_main+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lc $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-
-int
-main ()
-{
-main ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_lib_c_main=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_c_main=no
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_c_main" >&5
-echo "${ECHO_T}$ac_cv_lib_c_main" >&6
-if test $ac_cv_lib_c_main = yes; then
- cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBC 1
-_ACEOF
-
- LIBS="-lc $LIBS"
-
-fi
-
-
-echo "$as_me:$LINENO: checking for main in -lm" >&5
-echo $ECHO_N "checking for main in -lm... $ECHO_C" >&6
-if test "${ac_cv_lib_m_main+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lm $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-
-int
-main ()
-{
-main ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_lib_m_main=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_m_main=no
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_m_main" >&5
-echo "${ECHO_T}$ac_cv_lib_m_main" >&6
-if test $ac_cv_lib_m_main = yes; then
- cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBM 1
-_ACEOF
-
- LIBS="-lm $LIBS"
-
-fi
-
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
-echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
-# On Suns, sometimes $CPP names a directory.
-if test -n "$CPP" && test -d "$CPP"; then
- CPP=
-fi
-if test -z "$CPP"; then
- if test "${ac_cv_prog_CPP+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- # Double quotes because CPP needs to be expanded
- for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
- do
- ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
-do
- # Use a header file that comes with gcc, so configuring glibc
- # with a fresh cross-compiler works.
- # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- # <limits.h> exists even on freestanding compilers.
- # On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp. "Syntax error" is here to catch this case.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
- Syntax error
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- :
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Broken: fails on valid input.
-continue
-fi
-rm -f conftest.err conftest.$ac_ext
-
- # OK, works on sane cases. Now check whether non-existent headers
- # can be detected and how.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <ac_nonexistent.h>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- # Broken: success on invalid input.
-continue
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-rm -f conftest.err conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then
- break
-fi
-
- done
- ac_cv_prog_CPP=$CPP
-
-fi
- CPP=$ac_cv_prog_CPP
-else
- ac_cv_prog_CPP=$CPP
-fi
-echo "$as_me:$LINENO: result: $CPP" >&5
-echo "${ECHO_T}$CPP" >&6
-ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
-do
- # Use a header file that comes with gcc, so configuring glibc
- # with a fresh cross-compiler works.
- # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- # <limits.h> exists even on freestanding compilers.
- # On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp. "Syntax error" is here to catch this case.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
- Syntax error
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- :
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Broken: fails on valid input.
-continue
-fi
-rm -f conftest.err conftest.$ac_ext
-
- # OK, works on sane cases. Now check whether non-existent headers
- # can be detected and how.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <ac_nonexistent.h>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- # Broken: success on invalid input.
-continue
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-rm -f conftest.err conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then
- :
-else
- { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." >&5
-echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
-fi
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-echo "$as_me:$LINENO: checking for egrep" >&5
-echo $ECHO_N "checking for egrep... $ECHO_C" >&6
-if test "${ac_cv_prog_egrep+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if echo a | (grep -E '(a|b)') >/dev/null 2>&1
- then ac_cv_prog_egrep='grep -E'
- else ac_cv_prog_egrep='egrep'
- fi
-fi
-echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
-echo "${ECHO_T}$ac_cv_prog_egrep" >&6
- EGREP=$ac_cv_prog_egrep
-
-
-echo "$as_me:$LINENO: checking for ANSI C header files" >&5
-echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
-if test "${ac_cv_header_stdc+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_header_stdc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_header_stdc=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-
-if test $ac_cv_header_stdc = yes; then
- # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <string.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "memchr" >/dev/null 2>&1; then
- :
-else
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
- # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdlib.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "free" >/dev/null 2>&1; then
- :
-else
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
- # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
- if test "$cross_compiling" = yes; then
- :
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <ctype.h>
-#if ((' ' & 0x0FF) == 0x020)
-# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#else
-# define ISLOWER(c) \
- (('a' <= (c) && (c) <= 'i') \
- || ('j' <= (c) && (c) <= 'r') \
- || ('s' <= (c) && (c) <= 'z'))
-# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
-#endif
-
-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
-int
-main ()
-{
- int i;
- for (i = 0; i < 256; i++)
- if (XOR (islower (i), ISLOWER (i))
- || toupper (i) != TOUPPER (i))
- exit(2);
- exit (0);
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- :
-else
- echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-ac_cv_header_stdc=no
-fi
-rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-fi
-fi
-echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
-echo "${ECHO_T}$ac_cv_header_stdc" >&6
-if test $ac_cv_header_stdc = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define STDC_HEADERS 1
-_ACEOF
-
-fi
-
-# On IRIX 5.3, sys/types and inttypes.h are conflicting.
-
-
-
-
-
-
-
-
-
-for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
- inttypes.h stdint.h unistd.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- eval "$as_ac_Header=yes"
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-eval "$as_ac_Header=no"
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-
-
-
-
-
-
-for ac_header in stdlib.h stdio.h string.h math.h time.h sys/time.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to the AC_PACKAGE_NAME lists. ##
-## ------------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5
-echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6
-if test "${ac_cv_header_time+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <sys/types.h>
-#include <sys/time.h>
-#include <time.h>
-
-int
-main ()
-{
-if ((struct tm *) 0)
-return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_header_time=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_header_time=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5
-echo "${ECHO_T}$ac_cv_header_time" >&6
-if test $ac_cv_header_time = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define TIME_WITH_SYS_TIME 1
-_ACEOF
-
-fi
-
-
-
-
-for ac_header in stdlib.h unistd.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to the AC_PACKAGE_NAME lists. ##
-## ------------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-for ac_func in getpagesize
-do
-as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
-if eval "test \"\${$as_ac_var+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-char (*f) () = $ac_func;
-#endif
-#ifdef __cplusplus
-}
-#endif
-
-int
-main ()
-{
-return f != $ac_func;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- eval "$as_ac_var=yes"
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-eval "$as_ac_var=no"
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
-if test `eval echo '${'$as_ac_var'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-echo "$as_me:$LINENO: checking for working mmap" >&5
-echo $ECHO_N "checking for working mmap... $ECHO_C" >&6
-if test "${ac_cv_func_mmap_fixed_mapped+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test "$cross_compiling" = yes; then
- ac_cv_func_mmap_fixed_mapped=no
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-/* malloc might have been renamed as rpl_malloc. */
-#undef malloc
-
-/* Thanks to Mike Haertel and Jim Avera for this test.
- Here is a matrix of mmap possibilities:
- mmap private not fixed
- mmap private fixed at somewhere currently unmapped
- mmap private fixed at somewhere already mapped
- mmap shared not fixed
- mmap shared fixed at somewhere currently unmapped
- mmap shared fixed at somewhere already mapped
- For private mappings, we should verify that changes cannot be read()
- back from the file, nor mmap's back from the file at a different
- address. (There have been systems where private was not correctly
- implemented like the infamous i386 svr4.0, and systems where the
- VM page cache was not coherent with the file system buffer cache
- like early versions of FreeBSD and possibly contemporary NetBSD.)
- For shared mappings, we should conversely verify that changes get
- propagated back to all the places they're supposed to be.
-
- Grep wants private fixed already mapped.
- The main things grep needs to know about mmap are:
- * does it exist and is it safe to write into the mmap'd area
- * how to use it (BSD variants) */
-
-#include <fcntl.h>
-#include <sys/mman.h>
-
-#if !STDC_HEADERS && !HAVE_STDLIB_H
-char *malloc ();
-#endif
-
-/* This mess was copied from the GNU getpagesize.h. */
-#if !HAVE_GETPAGESIZE
-/* Assume that all systems that can run configure have sys/param.h. */
-# if !HAVE_SYS_PARAM_H
-# define HAVE_SYS_PARAM_H 1
-# endif
-
-# ifdef _SC_PAGESIZE
-# define getpagesize() sysconf(_SC_PAGESIZE)
-# else /* no _SC_PAGESIZE */
-# if HAVE_SYS_PARAM_H
-# include <sys/param.h>
-# ifdef EXEC_PAGESIZE
-# define getpagesize() EXEC_PAGESIZE
-# else /* no EXEC_PAGESIZE */
-# ifdef NBPG
-# define getpagesize() NBPG * CLSIZE
-# ifndef CLSIZE
-# define CLSIZE 1
-# endif /* no CLSIZE */
-# else /* no NBPG */
-# ifdef NBPC
-# define getpagesize() NBPC
-# else /* no NBPC */
-# ifdef PAGESIZE
-# define getpagesize() PAGESIZE
-# endif /* PAGESIZE */
-# endif /* no NBPC */
-# endif /* no NBPG */
-# endif /* no EXEC_PAGESIZE */
-# else /* no HAVE_SYS_PARAM_H */
-# define getpagesize() 8192 /* punt totally */
-# endif /* no HAVE_SYS_PARAM_H */
-# endif /* no _SC_PAGESIZE */
-
-#endif /* no HAVE_GETPAGESIZE */
-
-int
-main ()
-{
- char *data, *data2, *data3;
- int i, pagesize;
- int fd;
-
- pagesize = getpagesize ();
-
- /* First, make a file with some known garbage in it. */
- data = (char *) malloc (pagesize);
- if (!data)
- exit (1);
- for (i = 0; i < pagesize; ++i)
- *(data + i) = rand ();
- umask (0);
- fd = creat ("conftest.mmap", 0600);
- if (fd < 0)
- exit (1);
- if (write (fd, data, pagesize) != pagesize)
- exit (1);
- close (fd);
-
- /* Next, try to mmap the file at a fixed address which already has
- something else allocated at it. If we can, also make sure that
- we see the same garbage. */
- fd = open ("conftest.mmap", O_RDWR);
- if (fd < 0)
- exit (1);
- data2 = (char *) malloc (2 * pagesize);
- if (!data2)
- exit (1);
- data2 += (pagesize - ((long) data2 & (pagesize - 1))) & (pagesize - 1);
- if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE,
- MAP_PRIVATE | MAP_FIXED, fd, 0L))
- exit (1);
- for (i = 0; i < pagesize; ++i)
- if (*(data + i) != *(data2 + i))
- exit (1);
-
- /* Finally, make sure that changes to the mapped area do not
- percolate back to the file as seen by read(). (This is a bug on
- some variants of i386 svr4.0.) */
- for (i = 0; i < pagesize; ++i)
- *(data2 + i) = *(data2 + i) + 1;
- data3 = (char *) malloc (pagesize);
- if (!data3)
- exit (1);
- if (read (fd, data3, pagesize) != pagesize)
- exit (1);
- for (i = 0; i < pagesize; ++i)
- if (*(data + i) != *(data3 + i))
- exit (1);
- close (fd);
- exit (0);
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_func_mmap_fixed_mapped=yes
-else
- echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-ac_cv_func_mmap_fixed_mapped=no
-fi
-rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-fi
-echo "$as_me:$LINENO: result: $ac_cv_func_mmap_fixed_mapped" >&5
-echo "${ECHO_T}$ac_cv_func_mmap_fixed_mapped" >&6
-if test $ac_cv_func_mmap_fixed_mapped = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_MMAP 1
-_ACEOF
-
-fi
-rm -f conftest.mmap
-
-
-
-
-for ac_func in select socket strerror
-do
-as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
-if eval "test \"\${$as_ac_var+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-char (*f) () = $ac_func;
-#endif
-#ifdef __cplusplus
-}
-#endif
-
-int
-main ()
-{
-return f != $ac_func;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- eval "$as_ac_var=yes"
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-eval "$as_ac_var=no"
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
-if test `eval echo '${'$as_ac_var'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-
-
-LD=ld
-DFLAGS=""
-
-if test `uname -s` = Linux;
-then
- LFLAGS="-export_dynamic -shared"
- EXT=pd_linux
- STRIPFLAGS="--strip-unneeded"
-fi
-
-if test `uname -s` = Darwin;
-then
- LD=cc
- LFLAGS="-bundle -undefined suppress -flat_namespace"
- EXT=pd_darwin
- STRIPFLAGS=
- if test "$enable_lpt" = "yes"; then
- { { echo "$as_me:$LINENO: error: \"lpt not supported on this platform\"" >&5
-echo "$as_me: error: \"lpt not supported on this platform\"" >&2;}
- { (exit 1); exit 1; }; };
- fi
- if test "$enable_lpt" = ""; then
- { echo "$as_me:$LINENO: WARNING: \"lpt not supported on this platform - disabling\"" >&5
-echo "$as_me: WARNING: \"lpt not supported on this platform - disabling\"" >&2;};
- enable_lpt="no";
- fi
-fi
-if test `uname | sed -e 's/^MINGW.*/NT/'` = NT;
-then
- LD=gcc
- INCLUDES="-I@prefix@/src"
- DFLAGS="-DMSW -DNT"
- LFLAGS="-shared @prefix@/bin/pd.dll"
- EXT=dll
-else
- PDLIBDIR="/lib/pd"
- LIBS="-lc -lm"
-fi
-if test `uname -s` = IRIX64;
-then
- LFLAGS="-n32 -DUNIX -DIRIX -DN32 -woff 1080,1064,1185 \
- -OPT:roundoff=3 -OPT:IEEE_arithmetic=3 -OPT:cray_ivdep=true \
- -shared -rdata_shared"
- EXT=pd_irix6
- STRIPFLAGS="--strip-unneeded"
- if test "$enable_lpt" = "yes"; then
- { { echo "$as_me:$LINENO: error: \"lpt not supported on this platform\"" >&5
-echo "$as_me: error: \"lpt not supported on this platform\"" >&2;}
- { (exit 1); exit 1; }; };
- fi
- if test "$enable_lpt" = ""; then
- { echo "$as_me:$LINENO: WARNING: \"lpt not supported on this platform - disabling\"" >&5
-echo "$as_me: WARNING: \"lpt not supported on this platform - disabling\"" >&2;};
- enable_lpt="no";
- fi
-fi
-
-if test `uname -s` = IRIX32;
-then
- LFLAGS="-o32 -DUNIX -DIRIX -O2
- -shared -rdata_shared"
- EXT=pd_irix5
- STRIPFLAGS="--strip-unneeded"
- if test "$enable_lpt" = "yes"; then
- { { echo "$as_me:$LINENO: error: \"lpt not supported on this platform\"" >&5
-echo "$as_me: error: \"lpt not supported on this platform\"" >&2;}
- { (exit 1); exit 1; }; };
- fi
- if test "$enable_lpt" = ""; then
- { echo "$as_me:$LINENO: WARNING: \"lpt not supported on this platform - disabling\"" >&5
-echo "$as_me: WARNING: \"lpt not supported on this platform - disabling\"" >&2;};
- enable_lpt="no";
- fi
-fi
-
-echo "$as_me:$LINENO: checking \"pd\>=0.37\"" >&5
-echo $ECHO_N "checking \"pd\>=0.37\"... $ECHO_C" >&6
-
-if test "$with_pdversion" != ""
-then
-echo -n "($with_pdversion)... "
- PD_VERSION="$with_pdversion"
-else
-cat > conftest.c << EOF
-#include <stdio.h>
-#include "m_pd.h"
-int main(){
- printf("%d.%d\n", PD_MAJOR_VERSION, PD_MINOR_VERSION);
- return 0;
-}
-EOF
- if $CC $INCLUDES -o conftest.o conftest.c > /dev/null 2>&1
- then
- PD_VERSION=`./conftest.o`
- else
- PD_VERSION=""
- fi
-fi
-
-let PD_MAJORVERSION=`echo $PD_VERSION | cut -d"." -f1`+0
-let PD_MINORVERSION=`echo $PD_VERSION | cut -d"." -f2`+0
-
-if test "$PD_MAJORVERSION" -gt 0 || test "$PD_MINORVERSION" -ge 37
-then
- REFERENCEPATH=extra/help-
- echo "yes"
-else
- REFERENCEPATH=doc/5.reference/
- echo "no"
-fi
-
-echo "$as_me:$LINENO: checking \"zexy-version\"" >&5
-echo $ECHO_N "checking \"zexy-version\"... $ECHO_C" >&6
-cat > conftest.c << EOF
-#include <stdio.h>
-#include "zexy.h"
-int main(){
- printf("%s\n", VERSION);
- return 0;
-}
-EOF
-
-if $CC $INCLUDES -o conftest.o conftest.c > /dev/null 2>&1
-then
- ZEXY_VERSION=`./conftest.o`
- echo "$ZEXY_VERSION"
-else
- ZEXY_VERSION=""
- echo "(unknown)"
-fi
-
-
-echo "$as_me:$LINENO: checking \"parallel-port\"" >&5
-echo $ECHO_N "checking \"parallel-port\"... $ECHO_C" >&6
-if test "$enable_lpt" != "no"
-then
- if test "$enable_lpt" = "yes"
- then
- DFLAGS="$DFLAGS -DZ_WANT_LPT"
- echo "yes (forced)"
- else
-cat > conftest.c << EOF
-# include <sys/io.h>
-int main(){
- ioperm(0x3bc, 8, 1);
- outb(0, 0x3bc);
- ioperm(0x3bc, 8, 0);
- return 0;
-}
-EOF
-
- if $CC $INCLUDES -o conftest.o conftest.c > /dev/null 2>&1
- then
- DFLAGS="$DFLAGS -DZ_WANT_LPT"
- echo "yes"
- else
- echo "no"
- fi
- fi
-else
- echo "no (ignored)"
-fi
-
-echo "SOURCES = \\"> make.source
-for i in `ls z_*.c zexy.c`
-do
- echo " $i\\">> make.source
-done
-echo >> make.source
-
- ac_config_files="$ac_config_files makefile"
-cat >confcache <<\_ACEOF
-# This file is a shell script that caches the results of configure
-# tests run on this system so they can be shared between configure
-# scripts and configure runs, see configure's option --config-cache.
-# It is not useful on other systems. If it contains results you don't
-# want to keep, you may remove or edit it.
-#
-# config.status only pays attention to the cache file if you give it
-# the --recheck option to rerun configure.
-#
-# `ac_cv_env_foo' variables (set or unset) will be overridden when
-# loading this file, other *unset* `ac_cv_foo' will be assigned the
-# following values.
-
-_ACEOF
-
-# The following way of writing the cache mishandles newlines in values,
-# but we know of no workaround that is simple, portable, and efficient.
-# So, don't put newlines in cache variables' values.
-# Ultrix sh set writes to stderr and can't be redirected directly,
-# and sets the high bit in the cache file unless we assign to the vars.
-{
- (set) 2>&1 |
- case `(ac_space=' '; set | grep ac_space) 2>&1` in
- *ac_space=\ *)
- # `set' does not quote correctly, so add quotes (double-quote
- # substitution turns \\\\ into \\, and sed turns \\ into \).
- sed -n \
- "s/'/'\\\\''/g;
- s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
- ;;
- *)
- # `set' quotes correctly as required by POSIX, so do not add quotes.
- sed -n \
- "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
- ;;
- esac;
-} |
- sed '
- t clear
- : clear
- s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
- t end
- /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
- : end' >>confcache
-if diff $cache_file confcache >/dev/null 2>&1; then :; else
- if test -w $cache_file; then
- test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
- cat confcache >$cache_file
- else
- echo "not updating unwritable cache $cache_file"
- fi
-fi
-rm -f confcache
-
-test "x$prefix" = xNONE && prefix=$ac_default_prefix
-# Let make expand exec_prefix.
-test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-
-# VPATH may cause trouble with some makes, so we remove $(srcdir),
-# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
-# trailing colons and then remove the whole line if VPATH becomes empty
-# (actually we leave an empty line to preserve line numbers).
-if test "x$srcdir" = x.; then
- ac_vpsub='/^[ ]*VPATH[ ]*=/{
-s/:*\$(srcdir):*/:/;
-s/:*\${srcdir}:*/:/;
-s/:*@srcdir@:*/:/;
-s/^\([^=]*=[ ]*\):*/\1/;
-s/:*$//;
-s/^[^=]*=[ ]*$//;
-}'
-fi
-
-# Transform confdefs.h into DEFS.
-# Protect against shell expansion while executing Makefile rules.
-# Protect against Makefile macro expansion.
-#
-# If the first sed substitution is executed (which looks for macros that
-# take arguments), then we branch to the quote section. Otherwise,
-# look for a macro that doesn't take arguments.
-cat >confdef2opt.sed <<\_ACEOF
-t clear
-: clear
-s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g
-t quote
-s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g
-t quote
-d
-: quote
-s,[ `~#$^&*(){}\\|;'"<>?],\\&,g
-s,\[,\\&,g
-s,\],\\&,g
-s,\$,$$,g
-p
-_ACEOF
-# We use echo to avoid assuming a particular line-breaking character.
-# The extra dot is to prevent the shell from consuming trailing
-# line-breaks from the sub-command output. A line-break within
-# single-quotes doesn't work because, if this script is created in a
-# platform that uses two characters for line-breaks (e.g., DOS), tr
-# would break.
-ac_LF_and_DOT=`echo; echo .`
-DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'`
-rm -f confdef2opt.sed
-
-
-ac_libobjs=
-ac_ltlibobjs=
-for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
- # 1. Remove the extension, and $U if already installed.
- ac_i=`echo "$ac_i" |
- sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
- # 2. Add them.
- ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
- ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
-done
-LIBOBJS=$ac_libobjs
-
-LTLIBOBJS=$ac_ltlibobjs
-
-
-
-: ${CONFIG_STATUS=./config.status}
-ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files $CONFIG_STATUS"
-{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
-echo "$as_me: creating $CONFIG_STATUS" >&6;}
-cat >$CONFIG_STATUS <<_ACEOF
-#! $SHELL
-# Generated by $as_me.
-# Run this file to recreate the current configuration.
-# Compiler output produced by configure, useful for debugging
-# configure, is in config.log if it exists.
-
-debug=false
-ac_cs_recheck=false
-ac_cs_silent=false
-SHELL=\${CONFIG_SHELL-$SHELL}
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF
-## --------------------- ##
-## M4sh Initialization. ##
-## --------------------- ##
-
-# Be Bourne compatible
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
- emulate sh
- NULLCMD=:
- # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
- # is contrary to our usage. Disable this feature.
- alias -g '${1+"$@"}'='"$@"'
-elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
- set -o posix
-fi
-DUALCASE=1; export DUALCASE # for MKS sh
-
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
- as_unset=unset
-else
- as_unset=false
-fi
-
-
-# Work around bugs in pre-3.0 UWIN ksh.
-$as_unset ENV MAIL MAILPATH
-PS1='$ '
-PS2='> '
-PS4='+ '
-
-# NLS nuisances.
-for as_var in \
- LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
- LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
- LC_TELEPHONE LC_TIME
-do
- if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
- eval $as_var=C; export $as_var
- else
- $as_unset $as_var
- fi
-done
-
-# Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1; then
- as_expr=expr
-else
- as_expr=false
-fi
-
-if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
- as_basename=basename
-else
- as_basename=false
-fi
-
-
-# Name of the executable.
-as_me=`$as_basename "$0" ||
-$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
- X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)$' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X/"$0" |
- sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
- /^X\/\(\/\/\)$/{ s//\1/; q; }
- /^X\/\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
-
-
-# PATH needs CR, and LINENO needs CR and PATH.
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
- echo "#! /bin/sh" >conf$$.sh
- echo "exit 0" >>conf$$.sh
- chmod +x conf$$.sh
- if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
- PATH_SEPARATOR=';'
- else
- PATH_SEPARATOR=:
- fi
- rm -f conf$$.sh
-fi
-
-
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x$as_lineno_3" = "x$as_lineno_2" || {
- # Find who we are. Look in the path if we contain no path at all
- # relative or not.
- case $0 in
- *[\\/]* ) as_myself=$0 ;;
- *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
-
- ;;
- esac
- # We did not find ourselves, most probably we were run as `sh COMMAND'
- # in which case we are not to be found in the path.
- if test "x$as_myself" = x; then
- as_myself=$0
- fi
- if test ! -f "$as_myself"; then
- { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
-echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
- { (exit 1); exit 1; }; }
- fi
- case $CONFIG_SHELL in
- '')
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for as_base in sh bash ksh sh5; do
- case $as_dir in
- /*)
- if ("$as_dir/$as_base" -c '
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
- $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
- $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
- CONFIG_SHELL=$as_dir/$as_base
- export CONFIG_SHELL
- exec "$CONFIG_SHELL" "$0" ${1+"$@"}
- fi;;
- esac
- done
-done
-;;
- esac
-
- # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
- # uniformly replaced by the line number. The first 'sed' inserts a
- # line-number line before each line; the second 'sed' does the real
- # work. The second script uses 'N' to pair each line-number line
- # with the numbered line, and appends trailing '-' during
- # substitution so that $LINENO is not a special case at line end.
- # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
- # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
- sed '=' <$as_myself |
- sed '
- N
- s,$,-,
- : loop
- s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
- t loop
- s,-$,,
- s,^['$as_cr_digits']*\n,,
- ' >$as_me.lineno &&
- chmod +x $as_me.lineno ||
- { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
-echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
- { (exit 1); exit 1; }; }
-
- # Don't try to exec as it changes $[0], causing all sort of problems
- # (the dirname of $[0] is not the place where we might find the
- # original and so on. Autoconf is especially sensible to this).
- . ./$as_me.lineno
- # Exit status is that of the last command.
- exit
-}
-
-
-case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
- *c*,-n*) ECHO_N= ECHO_C='
-' ECHO_T=' ' ;;
- *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
- *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
-esac
-
-if expr a : '\(a\)' >/dev/null 2>&1; then
- as_expr=expr
-else
- as_expr=false
-fi
-
-rm -f conf$$ conf$$.exe conf$$.file
-echo >conf$$.file
-if ln -s conf$$.file conf$$ 2>/dev/null; then
- # We could just check for DJGPP; but this test a) works b) is more generic
- # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
- if test -f conf$$.exe; then
- # Don't use ln at all; we don't have any links
- as_ln_s='cp -p'
- else
- as_ln_s='ln -s'
- fi
-elif ln conf$$.file conf$$ 2>/dev/null; then
- as_ln_s=ln
-else
- as_ln_s='cp -p'
-fi
-rm -f conf$$ conf$$.exe conf$$.file
-
-if mkdir -p . 2>/dev/null; then
- as_mkdir_p=:
-else
- test -d ./-p && rmdir ./-p
- as_mkdir_p=false
-fi
-
-as_executable_p="test -f"
-
-# Sed expression to map a string onto a valid CPP name.
-as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
-
-# Sed expression to map a string onto a valid variable name.
-as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
-
-
-# IFS
-# We need space, tab and new line, in precisely that order.
-as_nl='
-'
-IFS=" $as_nl"
-
-# CDPATH.
-$as_unset CDPATH
-
-exec 6>&1
-
-# Open the log real soon, to keep \$[0] and so on meaningful, and to
-# report actual input values of CONFIG_FILES etc. instead of their
-# values after options handling. Logging --version etc. is OK.
-exec 5>>config.log
-{
- echo
- sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
-## Running $as_me. ##
-_ASBOX
-} >&5
-cat >&5 <<_CSEOF
-
-This file was extended by $as_me, which was
-generated by GNU Autoconf 2.59. Invocation command line was
-
- CONFIG_FILES = $CONFIG_FILES
- CONFIG_HEADERS = $CONFIG_HEADERS
- CONFIG_LINKS = $CONFIG_LINKS
- CONFIG_COMMANDS = $CONFIG_COMMANDS
- $ $0 $@
-
-_CSEOF
-echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
-echo >&5
-_ACEOF
-
-# Files that config.status was made for.
-if test -n "$ac_config_files"; then
- echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
-fi
-
-if test -n "$ac_config_headers"; then
- echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
-fi
-
-if test -n "$ac_config_links"; then
- echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
-fi
-
-if test -n "$ac_config_commands"; then
- echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
-fi
-
-cat >>$CONFIG_STATUS <<\_ACEOF
-
-ac_cs_usage="\
-\`$as_me' instantiates files from templates according to the
-current configuration.
-
-Usage: $0 [OPTIONS] [FILE]...
-
- -h, --help print this help, then exit
- -V, --version print version number, then exit
- -q, --quiet do not print progress messages
- -d, --debug don't remove temporary files
- --recheck update $as_me by reconfiguring in the same conditions
- --file=FILE[:TEMPLATE]
- instantiate the configuration file FILE
-
-Configuration files:
-$config_files
-
-Report bugs to <bug-autoconf@gnu.org>."
-_ACEOF
-
-cat >>$CONFIG_STATUS <<_ACEOF
-ac_cs_version="\\
-config.status
-configured by $0, generated by GNU Autoconf 2.59,
- with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
-
-Copyright (C) 2003 Free Software Foundation, Inc.
-This config.status script is free software; the Free Software Foundation
-gives unlimited permission to copy, distribute and modify it."
-srcdir=$srcdir
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF
-# If no file are specified by the user, then we need to provide default
-# value. By we need to know if files were specified by the user.
-ac_need_defaults=:
-while test $# != 0
-do
- case $1 in
- --*=*)
- ac_option=`expr "x$1" : 'x\([^=]*\)='`
- ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
- ac_shift=:
- ;;
- -*)
- ac_option=$1
- ac_optarg=$2
- ac_shift=shift
- ;;
- *) # This is not an option, so the user has probably given explicit
- # arguments.
- ac_option=$1
- ac_need_defaults=false;;
- esac
-
- case $ac_option in
- # Handling of the options.
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
- -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
- ac_cs_recheck=: ;;
- --version | --vers* | -V )
- echo "$ac_cs_version"; exit 0 ;;
- --he | --h)
- # Conflict between --help and --header
- { { echo "$as_me:$LINENO: error: ambiguous option: $1
-Try \`$0 --help' for more information." >&5
-echo "$as_me: error: ambiguous option: $1
-Try \`$0 --help' for more information." >&2;}
- { (exit 1); exit 1; }; };;
- --help | --hel | -h )
- echo "$ac_cs_usage"; exit 0 ;;
- --debug | --d* | -d )
- debug=: ;;
- --file | --fil | --fi | --f )
- $ac_shift
- CONFIG_FILES="$CONFIG_FILES $ac_optarg"
- ac_need_defaults=false;;
- --header | --heade | --head | --hea )
- $ac_shift
- CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
- ac_need_defaults=false;;
- -q | -quiet | --quiet | --quie | --qui | --qu | --q \
- | -silent | --silent | --silen | --sile | --sil | --si | --s)
- ac_cs_silent=: ;;
-
- # This is an error.
- -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
-Try \`$0 --help' for more information." >&5
-echo "$as_me: error: unrecognized option: $1
-Try \`$0 --help' for more information." >&2;}
- { (exit 1); exit 1; }; } ;;
-
- *) ac_config_targets="$ac_config_targets $1" ;;
-
- esac
- shift
-done
-
-ac_configure_extra_args=
-
-if $ac_cs_silent; then
- exec 6>/dev/null
- ac_configure_extra_args="$ac_configure_extra_args --silent"
-fi
-
-_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
-if \$ac_cs_recheck; then
- echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
- exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
-fi
-
-_ACEOF
-
-
-
-
-
-cat >>$CONFIG_STATUS <<\_ACEOF
-for ac_config_target in $ac_config_targets
-do
- case "$ac_config_target" in
- # Handling of arguments.
- "makefile" ) CONFIG_FILES="$CONFIG_FILES makefile" ;;
- *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
-echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
- { (exit 1); exit 1; }; };;
- esac
-done
-
-# If the user did not use the arguments to specify the items to instantiate,
-# then the envvar interface is used. Set only those that are not.
-# We use the long form for the default assignment because of an extremely
-# bizarre bug on SunOS 4.1.3.
-if $ac_need_defaults; then
- test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
-fi
-
-# Have a temporary directory for convenience. Make it in the build tree
-# simply because there is no reason to put it here, and in addition,
-# creating and moving files from /tmp can sometimes cause problems.
-# Create a temporary directory, and hook for its removal unless debugging.
-$debug ||
-{
- trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
- trap '{ (exit 1); exit 1; }' 1 2 13 15
-}
-
-# Create a (secure) tmp directory for tmp files.
-
-{
- tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
- test -n "$tmp" && test -d "$tmp"
-} ||
-{
- tmp=./confstat$$-$RANDOM
- (umask 077 && mkdir $tmp)
-} ||
-{
- echo "$me: cannot create a temporary directory in ." >&2
- { (exit 1); exit 1; }
-}
-
-_ACEOF
-
-cat >>$CONFIG_STATUS <<_ACEOF
-
-#
-# CONFIG_FILES section.
-#
-
-# No need to generate the scripts if there are no CONFIG_FILES.
-# This happens for instance when ./config.status config.h
-if test -n "\$CONFIG_FILES"; then
- # Protect against being on the right side of a sed subst in config.status.
- sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
- s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
-s,@SHELL@,$SHELL,;t t
-s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
-s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
-s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
-s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
-s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
-s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
-s,@exec_prefix@,$exec_prefix,;t t
-s,@prefix@,$prefix,;t t
-s,@program_transform_name@,$program_transform_name,;t t
-s,@bindir@,$bindir,;t t
-s,@sbindir@,$sbindir,;t t
-s,@libexecdir@,$libexecdir,;t t
-s,@datadir@,$datadir,;t t
-s,@sysconfdir@,$sysconfdir,;t t
-s,@sharedstatedir@,$sharedstatedir,;t t
-s,@localstatedir@,$localstatedir,;t t
-s,@libdir@,$libdir,;t t
-s,@includedir@,$includedir,;t t
-s,@oldincludedir@,$oldincludedir,;t t
-s,@infodir@,$infodir,;t t
-s,@mandir@,$mandir,;t t
-s,@build_alias@,$build_alias,;t t
-s,@host_alias@,$host_alias,;t t
-s,@target_alias@,$target_alias,;t t
-s,@DEFS@,$DEFS,;t t
-s,@ECHO_C@,$ECHO_C,;t t
-s,@ECHO_N@,$ECHO_N,;t t
-s,@ECHO_T@,$ECHO_T,;t t
-s,@LIBS@,$LIBS,;t t
-s,@CC@,$CC,;t t
-s,@CFLAGS@,$CFLAGS,;t t
-s,@LDFLAGS@,$LDFLAGS,;t t
-s,@CPPFLAGS@,$CPPFLAGS,;t t
-s,@ac_ct_CC@,$ac_ct_CC,;t t
-s,@EXEEXT@,$EXEEXT,;t t
-s,@OBJEXT@,$OBJEXT,;t t
-s,@STK@,$STK,;t t
-s,@DFLAGS@,$DFLAGS,;t t
-s,@LFLAGS@,$LFLAGS,;t t
-s,@EXT@,$EXT,;t t
-s,@LD@,$LD,;t t
-s,@STRIPFLAGS@,$STRIPFLAGS,;t t
-s,@ZEXY_VERSION@,$ZEXY_VERSION,;t t
-s,@REFERENCEPATH@,$REFERENCEPATH,;t t
-s,@PDLIBDIR@,$PDLIBDIR,;t t
-s,@INCLUDES@,$INCLUDES,;t t
-s,@SOURCES@,$SOURCES,;t t
-s,@CPP@,$CPP,;t t
-s,@EGREP@,$EGREP,;t t
-s,@LIBOBJS@,$LIBOBJS,;t t
-s,@LTLIBOBJS@,$LTLIBOBJS,;t t
-CEOF
-
-_ACEOF
-
- cat >>$CONFIG_STATUS <<\_ACEOF
- # Split the substitutions into bite-sized pieces for seds with
- # small command number limits, like on Digital OSF/1 and HP-UX.
- ac_max_sed_lines=48
- ac_sed_frag=1 # Number of current file.
- ac_beg=1 # First line for current file.
- ac_end=$ac_max_sed_lines # Line after last line for current file.
- ac_more_lines=:
- ac_sed_cmds=
- while $ac_more_lines; do
- if test $ac_beg -gt 1; then
- sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
- else
- sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
- fi
- if test ! -s $tmp/subs.frag; then
- ac_more_lines=false
- else
- # The purpose of the label and of the branching condition is to
- # speed up the sed processing (if there are no `@' at all, there
- # is no need to browse any of the substitutions).
- # These are the two extra sed commands mentioned above.
- (echo ':t
- /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
- if test -z "$ac_sed_cmds"; then
- ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
- else
- ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
- fi
- ac_sed_frag=`expr $ac_sed_frag + 1`
- ac_beg=$ac_end
- ac_end=`expr $ac_end + $ac_max_sed_lines`
- fi
- done
- if test -z "$ac_sed_cmds"; then
- ac_sed_cmds=cat
- fi
-fi # test -n "$CONFIG_FILES"
-
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
-for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
- # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
- case $ac_file in
- - | *:- | *:-:* ) # input from stdin
- cat >$tmp/stdin
- ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
- ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
- *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
- ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
- * ) ac_file_in=$ac_file.in ;;
- esac
-
- # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
- ac_dir=`(dirname "$ac_file") 2>/dev/null ||
-$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$ac_file" : 'X\(//\)[^/]' \| \
- X"$ac_file" : 'X\(//\)$' \| \
- X"$ac_file" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X"$ac_file" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
- { if $as_mkdir_p; then
- mkdir -p "$ac_dir"
- else
- as_dir="$ac_dir"
- as_dirs=
- while test ! -d "$as_dir"; do
- as_dirs="$as_dir $as_dirs"
- as_dir=`(dirname "$as_dir") 2>/dev/null ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$as_dir" : 'X\(//\)[^/]' \| \
- X"$as_dir" : 'X\(//\)$' \| \
- X"$as_dir" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X"$as_dir" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
- done
- test ! -n "$as_dirs" || mkdir $as_dirs
- fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
-echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
- { (exit 1); exit 1; }; }; }
-
- ac_builddir=.
-
-if test "$ac_dir" != .; then
- ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
- # A "../" for each directory in $ac_dir_suffix.
- ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
-else
- ac_dir_suffix= ac_top_builddir=
-fi
-
-case $srcdir in
- .) # No --srcdir option. We are building in place.
- ac_srcdir=.
- if test -z "$ac_top_builddir"; then
- ac_top_srcdir=.
- else
- ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
- fi ;;
- [\\/]* | ?:[\\/]* ) # Absolute path.
- ac_srcdir=$srcdir$ac_dir_suffix;
- ac_top_srcdir=$srcdir ;;
- *) # Relative path.
- ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
- ac_top_srcdir=$ac_top_builddir$srcdir ;;
-esac
-
-# Do not use `cd foo && pwd` to compute absolute paths, because
-# the directories may not exist.
-case `pwd` in
-.) ac_abs_builddir="$ac_dir";;
-*)
- case "$ac_dir" in
- .) ac_abs_builddir=`pwd`;;
- [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
- *) ac_abs_builddir=`pwd`/"$ac_dir";;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_builddir=${ac_top_builddir}.;;
-*)
- case ${ac_top_builddir}. in
- .) ac_abs_top_builddir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
- *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_srcdir=$ac_srcdir;;
-*)
- case $ac_srcdir in
- .) ac_abs_srcdir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
- *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_srcdir=$ac_top_srcdir;;
-*)
- case $ac_top_srcdir in
- .) ac_abs_top_srcdir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
- *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
- esac;;
-esac
-
-
-
- # Let's still pretend it is `configure' which instantiates (i.e., don't
- # use $as_me), people would be surprised to read:
- # /* config.h. Generated by config.status. */
- if test x"$ac_file" = x-; then
- configure_input=
- else
- configure_input="$ac_file. "
- fi
- configure_input=$configure_input"Generated from `echo $ac_file_in |
- sed 's,.*/,,'` by configure."
-
- # First look for the input files in the build tree, otherwise in the
- # src tree.
- ac_file_inputs=`IFS=:
- for f in $ac_file_in; do
- case $f in
- -) echo $tmp/stdin ;;
- [\\/$]*)
- # Absolute (can't be DOS-style, as IFS=:)
- test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
-echo "$as_me: error: cannot find input file: $f" >&2;}
- { (exit 1); exit 1; }; }
- echo "$f";;
- *) # Relative
- if test -f "$f"; then
- # Build tree
- echo "$f"
- elif test -f "$srcdir/$f"; then
- # Source tree
- echo "$srcdir/$f"
- else
- # /dev/null tree
- { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
-echo "$as_me: error: cannot find input file: $f" >&2;}
- { (exit 1); exit 1; }; }
- fi;;
- esac
- done` || { (exit 1); exit 1; }
-
- if test x"$ac_file" != x-; then
- { echo "$as_me:$LINENO: creating $ac_file" >&5
-echo "$as_me: creating $ac_file" >&6;}
- rm -f "$ac_file"
- fi
-_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
- sed "$ac_vpsub
-$extrasub
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
-:t
-/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
-s,@configure_input@,$configure_input,;t t
-s,@srcdir@,$ac_srcdir,;t t
-s,@abs_srcdir@,$ac_abs_srcdir,;t t
-s,@top_srcdir@,$ac_top_srcdir,;t t
-s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
-s,@builddir@,$ac_builddir,;t t
-s,@abs_builddir@,$ac_abs_builddir,;t t
-s,@top_builddir@,$ac_top_builddir,;t t
-s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
-" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
- rm -f $tmp/stdin
- if test x"$ac_file" != x-; then
- mv $tmp/out $ac_file
- else
- cat $tmp/out
- rm -f $tmp/out
- fi
-
-done
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF
-
-{ (exit 0); exit 0; }
-_ACEOF
-chmod +x $CONFIG_STATUS
-ac_clean_files=$ac_clean_files_save
-
-
-# configure is writing to config.log, and then calls config.status.
-# config.status does its own redirection, appending to config.log.
-# Unfortunately, on DOS this fails, as config.log is still kept open
-# by configure, so config.status won't be able to write to it; its
-# output is simply discarded. So we exec the FD to /dev/null,
-# effectively closing config.log, so it can be properly (re)opened and
-# appended to by config.status. When coming back to configure, we
-# need to make the FD available again.
-if test "$no_create" != yes; then
- ac_cs_success=:
- ac_config_status_args=
- test "$silent" = yes &&
- ac_config_status_args="$ac_config_status_args --quiet"
- exec 5>/dev/null
- $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
- exec 5>>config.log
- # Use ||, not &&, to avoid exiting from the if with $? = 1, which
- # would make configure fail if this is the last instruction.
- $ac_cs_success || { (exit 1); exit 1; }
-fi
-
-
-rm -f conftest.*
diff --git a/src/configure.in b/src/configure.in
index a2cbd49..1216d3f 100644
--- a/src/configure.in
+++ b/src/configure.in
@@ -214,13 +214,14 @@ else
echo "no (ignored)"
fi
-echo "SOURCES = \\"> make.source
-for i in `ls z_*.c zexy.c`
+echo "SOURCES = \\"> Make.source
+for i in `ls *.c`
do
- echo " $i\\">> make.source
+ echo " $i\\">> Make.source
done
-echo >> make.source
+echo >> Make.source
-AC_OUTPUT(makefile)
+AC_OUTPUT(Makefile)
-rm -f conftest.* \ No newline at end of file
+rm -f conftest.*
+./makesource.sh
diff --git a/src/z_datetime.c b/src/date.c
index 8f95fe1..bd513ac 100644
--- a/src/z_datetime.c
+++ b/src/date.c
@@ -1,3 +1,19 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
/*
(c) 1202:forum::für::umläute:2000
1506:forum::für::umläute:2003: use timeb only if needed (like on windoze)
@@ -8,102 +24,24 @@
*/
#ifdef NT
-#pragma warning( disable : 4244 )
-#pragma warning( disable : 4305 )
-#define USE_TIMEB
+# define USE_TIMEB
#endif
#ifdef MACOSX
-#include <sys/types.h>
+# include <sys/types.h>
/* typedef _BSD_TIME_T_ time_t; */
#endif
#include "zexy.h"
#include <time.h>
-#ifdef USE_TIMEB
-#include <sys/timeb.h>
-#else
-#include <sys/time.h>
-#endif
-
-
-/* ----------------------- time --------------------- */
-
-static t_class *time_class;
-
-typedef struct _time
-{
- t_object x_obj;
-
- int GMT;
-
- t_outlet *x_outlet1;
- t_outlet *x_outlet2;
- t_outlet *x_outlet3;
- t_outlet *x_outlet4;
-} t_time;
-
-static void *time_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_time *x = (t_time *)pd_new(time_class);
- char buf[5];
-
- x->GMT=0;
- if (argc) {
- atom_string(argv, buf, 5);
- if (buf[0]=='G' && buf[1]=='M' && buf[2]=='T')
- x->GMT = 1;
- }
-
- x->x_outlet1 = outlet_new(&x->x_obj, &s_float);
- x->x_outlet2 = outlet_new(&x->x_obj, &s_float);
- x->x_outlet3 = outlet_new(&x->x_obj, &s_float);
- x->x_outlet4 = outlet_new(&x->x_obj, &s_float);
-
- return (x);
-}
-static void time_bang(t_time *x)
-{
- struct tm *resolvetime;
- float ms = 0.f;
#ifdef USE_TIMEB
- struct timeb mytime;
- ftime(&mytime);
- resolvetime = (x->GMT)?gmtime(&mytime.time):localtime(&mytime.time);
- ms=mytime.millitm;
+# include <sys/timeb.h>
#else
- struct timeval tv;
- gettimeofday(&tv, 0);
- resolvetime = (x->GMT)?gmtime(&tv.tv_sec):localtime(&tv.tv_sec);
- ms = tv.tv_usec*0.001;
+# include <sys/time.h>
#endif
- // outlet_float(x->x_outlet4, (t_float)(mytime.millitm));
- outlet_float(x->x_outlet4, (t_float)(ms));
- outlet_float(x->x_outlet3, (t_float)resolvetime->tm_sec);
- outlet_float(x->x_outlet2, (t_float)resolvetime->tm_min);
- outlet_float(x->x_outlet1, (t_float)resolvetime->tm_hour);
-}
-
-static void help_time(t_time *x)
-{
- post("\n%c time\t\t:: get the current system time", HEARTSYMBOL);
- post("\noutputs are\t: hour / minute / sec / msec");
- post("\ncreation\t:: 'time [GMT]': show local time or GMT");
-}
-void time_setup(void)
-{
- time_class = class_new(gensym("time"),
- (t_newmethod)time_new, 0,
- sizeof(t_time), 0, A_GIMME, 0);
-
- class_addbang(time_class, time_bang);
-
- class_addmethod(time_class, (t_method)help_time, gensym("help"), 0);
- class_sethelpsymbol(time_class, gensym("zexy/time"));
-}
/* ----------------------- date --------------------- */
@@ -182,14 +120,5 @@ void date_setup(void)
class_addmethod(date_class, (t_method)help_date, gensym("help"), 0);
class_sethelpsymbol(date_class, gensym("zexy/date"));
-}
-
-
-/* general setup */
-
-
-void z_datetime_setup(void)
-{
- time_setup();
- date_setup();
+ zexy_register("date");
}
diff --git a/src/z_multiplex.c b/src/demultiplex.c
index 2c1ec19..ff26b5d 100644
--- a/src/z_multiplex.c
+++ b/src/demultiplex.c
@@ -1,9 +1,26 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
/* 1509:forum::für::umläute:2000 */
/*
demux : multiplex the input to a specified output
-to do:: mux : demultiplex a specified input to the output
+
+ TODO:: mux : demultiplex a specified input to the output
*/
#include "zexy.h"
@@ -82,7 +99,7 @@ static void *demux_new(t_symbol *s, int argc, t_atom *argv)
return (x);
}
-static void demux_setup(void)
+void demultiplex_setup(void)
{
demux_class = class_new(gensym("demultiplex"), (t_newmethod)demux_new,
0, sizeof(t_demux), 0, A_GIMME, 0);
@@ -94,78 +111,5 @@ static void demux_setup(void)
class_addmethod (demux_class, (t_method)demux_select, gensym("select"), A_DEFFLOAT, 0);
class_sethelpsymbol(demux_class, gensym("zexy/demultiplex"));
-}
-
-
-#ifdef MUX
-/* ------------------------- mux ------------------------------- */
-
-/*
- a multiplexer
-*/
-
-static t_class *mux_class;
-
-typedef struct _mux
-{
- t_object x_obj;
-
- int n_in;
- t_inlet **in, *selected;
-} t_mux;
-
-static void mux_select(t_mux *x, t_float f)
-{
- int n = ( (f<0) || (f>x->n_in) ) ? 0 : f;
-}
-
-static void mux_incoming(t_mux *x, t_symbol *s, int argc, t_atom *argv)
-{
- error("symbol @ %x", s);
-}
-
-static void *mux_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_mux *x = (t_mux *)pd_new(mux_class);
-
- int n = (argc < 2)?2:argc;
-
- x->n_in = n;
- x->in = (t_inlet **)getbytes(x->n_in * sizeof(t_inlet *));
-
- for (n = 0; n<x->n_in; n++) {
- char name[8];
- int i = 8;
-
- while (i--) name[i]=0;
-
- sprintf(name, "inlet%d", n);
-
- x->in[n] = inlet_new (&x->x_obj, &x->x_obj.ob_pd, &s_list, gensym(name));
- class_addmethod (mux_class, (t_method)mux_incoming, gensym(name), A_GIMME, 0);
- }
-
-
- outlet_new(&x->x_obj, 0);
- return (x);
-}
-
-static void mux_setup(void)
-{
- mux_class = class_new(gensym("multiplex"), (t_newmethod)mux_new,
- 0, sizeof(t_mux), 0, A_GIMME, 0);
- class_addcreator((t_newmethod)mux_new, gensym("mux"), A_GIMME, 0);
-
- class_addfloat (mux_class, (t_method)mux_select);
-
- class_sethelpsymbol(mux_class, gensym("zexy/multiplex"));
-}
-#endif
-
-void z_multiplex_setup(void)
-{
- demux_setup();
-#ifdef MUX
- mux_setup();
-#endif
+ zexy_register("demultiplex");
}
diff --git a/src/demultiplex_tilde.c b/src/demultiplex_tilde.c
new file mode 100644
index 0000000..4d78583
--- /dev/null
+++ b/src/demultiplex_tilde.c
@@ -0,0 +1,119 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
+#include "zexy.h"
+
+/* ------------------------------------------------------------------------------ */
+
+/* demux~ : demultiplex a signal to a specified output */
+
+static t_class *demux_class;
+
+typedef struct _demux {
+ t_object x_obj;
+
+ int output;
+
+ int n_out;
+ t_float **out;
+
+} t_demux;
+
+static void demux_output(t_demux *x, t_floatarg f)
+{
+ if ((f>=0)&&(f<x->n_out)){
+ x->output=f;
+ } else
+ error("demultiplex: %d is channel out of range (0..%d)", (int)f, x->n_out);
+}
+
+
+static t_int *demux_perform(t_int *w)
+{
+ t_demux *x = (t_demux *)(w[1]);
+ t_float *in = (t_float *)(w[2]);
+ int N = (int)(w[3]);
+ int n = N;
+
+
+ int channel=x->n_out;
+
+
+ while(channel--){
+ t_float*out=x->out[channel];
+ n=N;
+ if(x->output==channel){
+ while(n--)*out++=*in++;
+ } else
+ while(n--)*out++=0.f;
+ }
+ return (w+4);
+}
+
+static void demux_dsp(t_demux *x, t_signal **sp)
+{
+ int n = x->n_out;
+ t_float **dummy=x->out;
+ while(n--)*dummy++=sp[x->n_out-n]->s_vec;
+ dsp_add(demux_perform, 3, x, sp[0]->s_vec, sp[0]->s_n);
+}
+
+
+static void demux_helper(void)
+{
+ post("\n%c demux~\t:: demultiplex a signal to one of various outlets", HEARTSYMBOL);
+ post("<#out>\t : the outlet-number (counting from 0) to witch the inlet is routed"
+ "'help'\t : view this");
+ post("creation : \"demux~ [arg1 [arg2...]]\"\t: the number of arguments equals the number of outlets\n");
+}
+
+static void demux_free(t_demux *x)
+{
+ freebytes(x->out, x->n_out * sizeof(t_float *));
+}
+
+static void *demux_new(t_symbol *s, int argc, t_atom *argv)
+{
+ t_demux *x = (t_demux *)pd_new(demux_class);
+ int i;
+
+ if (!argc)argc=2;
+ x->n_out=argc;
+ x->output=0;
+
+ while(argc--)outlet_new(&x->x_obj, gensym("signal"));
+
+ x->out = (t_float **)getbytes(x->n_out * sizeof(t_float *));
+ i=x->n_out;
+ while(i--)x->out[i]=0;
+
+ return (x);
+}
+
+void demultiplex_tilde_setup(void)
+{
+ demux_class = class_new(gensym("demultiplex~"), (t_newmethod)demux_new, (t_method)demux_free, sizeof(t_demux), 0, A_GIMME, 0);
+ class_addcreator((t_newmethod)demux_new, gensym("demux~"), A_GIMME, 0);
+
+ class_addfloat(demux_class, demux_output);
+ class_addmethod(demux_class, (t_method)demux_dsp, gensym("dsp"), 0);
+ class_addmethod(demux_class, nullfn, gensym("signal"), 0);
+
+ class_addmethod(demux_class, (t_method)demux_helper, gensym("help"), 0);
+ class_sethelpsymbol(demux_class, gensym("zexy/demultiplex~"));
+
+ zexy_register("demultiplex~");
+}
diff --git a/src/z_dfreq.c b/src/dfreq_tilde.c
index e5074a5..7be3d01 100644
--- a/src/z_dfreq.c
+++ b/src/dfreq_tilde.c
@@ -1,12 +1,23 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
#include <stdio.h>
#include "zexy.h"
-#ifdef NT
-#pragma warning( disable : 4244 )
-#pragma warning( disable : 4305 )
-#endif
-
/* ------------------------ dspobj~ ----------------------------- */
/* datendefinition */
@@ -88,7 +99,7 @@ static void helper(void)
}
-void z_dfreq_setup(void)
+void dfreq_tilde_setup(void)
{
dfreq_class = class_new(gensym("dfreq~"), (t_newmethod)dfreq_new, 0,
sizeof(t_dfreq), 0, A_DEFFLOAT, 0);
@@ -97,5 +108,5 @@ void z_dfreq_setup(void)
class_addmethod(dfreq_class, (t_method)helper, gensym("help"), 0);
class_sethelpsymbol(dfreq_class, gensym("zexy/dfreq~"));
+ zexy_register("dfreq~");
}
-
diff --git a/src/dirac_tilde.c b/src/dirac_tilde.c
new file mode 100644
index 0000000..72cc4d3
--- /dev/null
+++ b/src/dirac_tilde.c
@@ -0,0 +1,113 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
+
+/*
+This external makes the two main test-functions available :
+dirac~ : will make a single peak (eg: a 1 in all the 0s) at a desired position in the signal-vector
+ the position can be passed as an argument when creating the object
+step~ : will make a unity step at a desired point in the signal-vector; the second input specifies a
+ length: after the so-specified time has elapsed, the step will toggle back to the previous
+ value;
+ the length can be passed as an argument when creating the object
+ with length==1 you might do the dirac~ thing a little bit more complicated
+ with length==0 the output just toggles between 0 and 1 every time you bang the object
+
+NOTE : the inlets do NOT specify any times but sample-NUMBERS; there are 64 samples in a signal-vector,
+ each "lasting" for 1/44100 secs.
+*/
+
+#include "zexy.h"
+
+/* ------------------------ dirac~ ----------------------------- */
+
+
+static t_class *dirac_class;
+
+typedef struct _dirac
+{
+ t_object x_obj;
+ t_float position;
+ t_float do_it;
+} t_dirac;
+
+static void dirac_bang(t_dirac *x)
+{
+ x->do_it = x->position;
+}
+
+static void dirac_float(t_dirac *x, t_float where)
+{
+ x->do_it = x->position = where;
+}
+
+static t_int *dirac_perform(t_int *w)
+{
+ t_dirac *x = (t_dirac *)(w[1]);
+ t_float *out = (t_float *)(w[2]);
+ int n = (int)(w[3]);
+
+ int do_it = x->do_it;
+
+ while (n--)
+ {
+ *out++ = (!do_it--);
+ }
+ x->do_it = do_it;
+
+ return (w+4);
+}
+
+static void dirac_dsp(t_dirac *x, t_signal **sp)
+{
+ dsp_add(dirac_perform, 3, x, sp[0]->s_vec, sp[0]->s_n);
+}
+
+static void dirac_helper(void)
+{
+ post("%c dirac~-object :: generates a dirac (unity-pulse)", HEARTSYMBOL);
+ post("creation : \"dirac~ [<position>]\" : create a dirac at specified position (in samples)\n"
+ "inlet\t: <position>\t: create a dirac at new position\n"
+ "\t 'bang'\t: create a dirac at specified position\n"
+ "\t 'help'\t: view this\n"
+ "outlet\t: signal~");
+}
+
+
+
+static void *dirac_new(t_floatarg where)
+{
+ t_dirac *x = (t_dirac *)pd_new(dirac_class);
+
+ outlet_new(&x->x_obj, gensym("signal"));
+
+ x->do_it = 0;
+ x->position = where;
+ return (x);
+}
+
+void dirac_tilde_setup(void)
+{
+ dirac_class = class_new(gensym("dirac~"), (t_newmethod)dirac_new, 0,
+ sizeof(t_dirac), 0, A_DEFFLOAT, 0);
+ class_addfloat(dirac_class, dirac_float);
+ class_addbang(dirac_class, dirac_bang);
+ class_addmethod(dirac_class, (t_method)dirac_dsp, gensym("dsp"), 0);
+
+ class_addmethod(dirac_class, (t_method)dirac_helper, gensym("help"), 0);
+ class_sethelpsymbol(dirac_class, gensym("zexy/dirac~"));
+ zexy_register("dirac~");
+}
diff --git a/src/dot.c b/src/dot.c
new file mode 100644
index 0000000..df0ec5c
--- /dev/null
+++ b/src/dot.c
@@ -0,0 +1,162 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
+/* 2305:forum::für::umläute:2001 */
+
+/*skalar multiplikation */
+
+
+#include "zexy.h"
+
+static t_class *scalmul_class;
+static t_class *scalmul_scal_class;
+
+typedef struct _scalmul
+{
+ t_object x_obj;
+
+ t_int n1, n2;
+
+ t_float *buf1, *buf2;
+
+ t_float f;
+} t_scalmul;
+
+
+static void scalmul_lst2(t_scalmul *x, t_symbol *s, int argc, t_atom *argv)
+{
+ t_float *fp;
+ if (x->n2 != argc) {
+ freebytes(x->buf2, x->n2 * sizeof(t_float));
+ x->n2 = argc;
+ x->buf2=(t_float *)getbytes(sizeof(t_float)*x->n2);
+ };
+ fp = x->buf2;
+ while(argc--)*fp++=atom_getfloat(argv++);
+}
+
+static void scalmul_lst(t_scalmul *x, t_symbol *s, int argc, t_atom *argv)
+{
+ t_float *fp;
+ t_atom *ap;
+ int n;
+
+ if (argc){
+ if (x->n1 != argc) {
+ freebytes(x->buf1, x->n1 * sizeof(t_float));
+ x->n1 = argc;
+ x->buf1=(t_float *)getbytes(sizeof(t_float)*x->n1);
+ };
+ fp = x->buf1;
+ while(argc--)*fp++=atom_getfloat(argv++);
+ }
+
+ if (x->n1*x->n2==1){
+ outlet_float(x->x_obj.ob_outlet, *x->buf1**x->buf2);
+ return;
+ }
+ if (x->n1==1){
+ t_atom *a;
+ int i = x->n2;
+ t_float f = *x->buf1;
+ fp = x->buf2;
+ n = x->n2;
+ ap = (t_atom *)getbytes(sizeof(t_atom)*n);
+ a = ap;
+ while(i--){
+ SETFLOAT(a, *fp++*f);
+ a++;
+ }
+ } else if (x->n2==1){
+ t_float f = *x->buf2;
+ t_atom *a;
+ int i = x->n1;
+ n = x->n1;
+ ap = (t_atom *)getbytes(sizeof(t_atom)*n);
+ a = ap;
+ fp = x->buf1;
+ while(i--){
+ SETFLOAT(a, *fp++*f);
+ a++;
+ }
+ } else {
+ t_atom *a;
+ int i;
+ t_float *fp2=x->buf2;
+ fp = x->buf1;
+ n = x->n1;
+ if (x->n1!=x->n2){
+ post("scalar multiplication: truncating vectors to the same length");
+ if (x->n2<x->n1)n=x->n2;
+ }
+ ap = (t_atom *)getbytes(sizeof(t_atom)*n);
+ a = ap;
+ i=n;
+ while(i--){
+ SETFLOAT(a, *fp++**fp2++);
+ a++;
+ }
+ }
+ outlet_list(x->x_obj.ob_outlet, gensym("list"), n, ap);
+ freebytes(ap, sizeof(t_atom)*n);
+}
+static void scalmul_free(t_scalmul *x)
+{
+ freebytes(x->buf1, sizeof(t_float)*x->n1);
+ freebytes(x->buf2, sizeof(t_float)*x->n2);
+}
+
+static void *scalmul_new(t_symbol *s, int argc, t_atom *argv)
+{
+ t_scalmul *x;
+
+ if (argc-1){
+ x = (t_scalmul *)pd_new(scalmul_class);
+ inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("list"), gensym(""));
+ } else x = (t_scalmul *)pd_new(scalmul_scal_class);
+
+ outlet_new(&x->x_obj, 0);
+
+ x->n1 =1;
+ x->buf1 =(t_float*)getbytes(sizeof(t_float));
+ *x->buf1=0;
+
+ if (argc)scalmul_lst2(x, gensym("list"), argc, argv);
+ else {
+ x->n2 =1;
+ x->buf2 =(t_float*)getbytes(sizeof(t_float));
+ *x->buf2=0;
+ }
+
+ if (argc==1)floatinlet_new(&x->x_obj, x->buf2);
+
+ return (x);
+}
+
+void dot_setup(void)
+{
+ scalmul_class = class_new(gensym("."), (t_newmethod)scalmul_new,
+ (t_method)scalmul_free, sizeof(t_scalmul), 0, A_GIMME, 0);
+ class_addlist(scalmul_class, scalmul_lst);
+ class_addmethod (scalmul_class, (t_method)scalmul_lst2, gensym(""), A_GIMME, 0);
+ scalmul_scal_class = class_new(gensym("."), 0, (t_method)scalmul_free,
+ sizeof(t_scalmul), 0, 0);
+ class_addlist(scalmul_scal_class, scalmul_lst);
+
+ class_sethelpsymbol(scalmul_class, gensym("zexy/scalarmult"));
+ class_sethelpsymbol(scalmul_scal_class, gensym("zexy/scalarmult"));
+ zexy_register(".");
+}
diff --git a/src/z_drip.c b/src/drip.c
index 939d547..2679588 100644
--- a/src/z_drip.c
+++ b/src/drip.c
@@ -1,3 +1,19 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
/* 3009:forum::für::umläute:2000 */
/* -------------------- drip ------------------------------ */
@@ -170,7 +186,7 @@ static void *drip_new(t_symbol *s, int argc, t_atom *argv)
return (x);
}
-void z_drip_setup(void)
+void drip_setup(void)
{
drip_class = class_new(gensym("drip"), (t_newmethod)drip_new,
(t_method)drip_free, sizeof(t_drip), 0 ,A_GIMME, 0);
@@ -182,4 +198,5 @@ void z_drip_setup(void)
class_addlist (drip_class, drip_list);
class_addanything(drip_class, drip_anything);
class_sethelpsymbol(drip_class, gensym("zexy/drip"));
+ zexy_register("drip");
}
diff --git a/src/z_sigaverage.c b/src/envrms_tilde.c
index 3e3e261..e9dc302 100644
--- a/src/z_sigaverage.c
+++ b/src/envrms_tilde.c
@@ -1,20 +1,26 @@
-#include "zexy.h"
-#include <math.h>
-
-#ifdef NT
-#pragma warning( disable : 4244 )
-#pragma warning( disable : 4305 )
-#define sqrtf sqrt
-#endif
-
-#ifdef MACOSX
-#define sqrtf sqrt
-#endif
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
/* ---------------- envrms~ - simple envelope follower. ----------------- */
/* this is exactly the same as msp's env~-object, but does not output dB but RMS !! */
/* i found env~+dbtorms most inconvenient (and expensive...) */
+#include "zexy.h"
+#include <math.h>
+
#define MAXOVERLAP 10
#define MAXVSTAKEN 64
@@ -131,7 +137,7 @@ static void sigenvrms_help(void)
}
-void sigenvrms_setup(void )
+void envrms_tilde_setup(void)
{
sigenvrms_class = class_new(gensym("envrms~"), (t_newmethod)sigenvrms_new,
(t_method)sigenvrms_ff, sizeof(t_sigenvrms), 0, A_DEFFLOAT, A_DEFFLOAT, 0);
@@ -140,152 +146,5 @@ void sigenvrms_setup(void )
class_addmethod(sigenvrms_class, (t_method)sigenvrms_help, gensym("help"), 0);
class_sethelpsymbol(sigenvrms_class, gensym("zexy/envrms~"));
-}
-
-/* ------------------------ average~ ----------------------------- */
-
-/* tilde object to take absolute value. */
-
-static t_class *avg_class;
-
-typedef struct _avg
-{
- t_object x_obj;
-
- t_float n_inv;
- t_float buf;
- int blocks;
-} t_avg;
-
-
-/* average :: arithmetic mean of one signal-vector */
-
-static t_int *avg_perform(t_int *w)
-{
- t_float *in = (t_float *)(w[1]);
-
- t_avg *x = (t_avg *)w[2];
- int n = (int)(w[3]);
-
- t_float buf = 0.;
-
- while (n--)
- {
- buf += *in++;
- }
- outlet_float(x->x_obj.ob_outlet, buf*x->n_inv);
-
- return (w+4);
-}
-
-static void avg_dsp(t_avg *x, t_signal **sp)
-{
- x->n_inv=1./sp[0]->s_n;
- dsp_add(avg_perform, 3, sp[0]->s_vec, x, sp[0]->s_n);
-}
-
-static void *avg_new(void)
-{
- t_avg *x = (t_avg *)pd_new(avg_class);
- outlet_new(&x->x_obj, gensym("float"));
- return (x);
-}
-
-static void avg_help(void)
-{
- post("avg~\t:: outputs the arithmetic mean of each signal-vector");
-}
-
-
-void avg_setup(void)
-{
- avg_class = class_new(gensym("avg~"), (t_newmethod)avg_new, 0,
- sizeof(t_avg), 0, A_DEFFLOAT, 0);
- class_addmethod(avg_class, nullfn, gensym("signal"), 0);
- class_addmethod(avg_class, (t_method)avg_dsp, gensym("dsp"), 0);
-
- class_addmethod(avg_class, (t_method)avg_help, gensym("help"), 0);
- class_sethelpsymbol(avg_class, gensym("zexy/avg~"));
-}
-
-
-/* triggered average :: arithmetic mean between last and current BANG */
-
-static t_class *tavg_class;
-
-typedef struct _tavg
-{
- t_object x_obj;
-
- t_float n_inv;
- t_float buf;
- int blocks;
-} t_tavg;
-
-
-
-static void tavg_bang(t_avg *x)
-{
- if (x->blocks) {
- outlet_float(x->x_obj.ob_outlet, x->buf*x->n_inv/x->blocks);
- x->blocks = 0;
- x->buf = 0.;
- }
-}
-
-static t_int *tavg_perform(t_int *w)
-{
- t_float *in = (t_float *)(w[1]);
- t_tavg *x = (t_tavg *)w[2];
- int n = (int)(w[3]);
-
- t_float buf = x->buf;
-
- while (n--) buf += *in++;
-
- x->buf = buf;
- x->blocks++;
-
- return (w+4);
-}
-
-static void tavg_dsp(t_tavg *x, t_signal **sp)
-{
- x->n_inv=1./sp[0]->s_n;
- dsp_add(tavg_perform, 3, sp[0]->s_vec, x, sp[0]->s_n);
-}
-
-static void *tavg_new(void)
-{
- t_tavg *x = (t_tavg *)pd_new(tavg_class);
- outlet_new(&x->x_obj, gensym("float"));
- return (x);
-}
-
-static void tavg_help(void)
-{
- post("tavg~\t\t:: outputs the arithmetic mean of a signal when triggered");
- post("<bang>\t\t: triggers the output");
-}
-
-void tavg_setup(void)
-{
- tavg_class = class_new(gensym("tavg~"), (t_newmethod)tavg_new, 0,
- sizeof(t_tavg), 0, A_DEFFLOAT, 0);
- class_addmethod(tavg_class, nullfn, gensym("signal"), 0);
- class_addmethod(tavg_class, (t_method)tavg_dsp, gensym("dsp"), 0);
-
- class_addbang(tavg_class, tavg_bang);
-
- class_addmethod(tavg_class, (t_method)tavg_help, gensym("help"), 0);
- class_sethelpsymbol(tavg_class, gensym("zexy/tavg~"));
-}
-
-/* global setup routine */
-
-void z_sigaverage_setup(void)
-{
- avg_setup();
- tavg_setup();
- sigenvrms_setup();
+ zexy_register("envrms~");
}
diff --git a/src/glue.c b/src/glue.c
new file mode 100644
index 0000000..de9a88a
--- /dev/null
+++ b/src/glue.c
@@ -0,0 +1,114 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
+
+#include "zexy.h"
+#include <string.h>
+
+
+/* ------------------------- glue ------------------------------- */
+
+/* glue 2 lists together (append) */
+
+static t_class *glue_class;
+
+typedef struct _glue
+{
+ t_object x_obj;
+
+ t_atom *ap2, *ap;
+ t_int n1, n2, n;
+
+ t_int changed;
+} t_glue;
+
+static void glue_lst2(t_glue *x, t_symbol *s, int argc, t_atom *argv)
+{
+ x->changed = 1;
+ if (x->n2 != argc) {
+ freebytes(x->ap2, x->n2 * sizeof(t_atom));
+ x->n2 = argc;
+ x->ap2 = copybytes(argv, argc * sizeof(t_atom));
+ } else memcpy(x->ap2, argv, argc * sizeof(t_atom));
+}
+
+static void glue_lst(t_glue *x, t_symbol *s, int argc, t_atom *argv)
+{
+ if (x->n != x->n2+argc) {
+ freebytes(x->ap, x->n * sizeof(t_atom));
+ x->n1 = argc;
+ x->n = x->n1+x->n2;
+ x->ap = (t_atom *)getbytes(sizeof(t_atom)*x->n);
+ memcpy(x->ap+argc, x->ap2, x->n2*sizeof(t_atom));
+ } else if ((x->n1 != argc)||x->changed)memcpy(x->ap+argc, x->ap2, x->n2*sizeof(t_atom));
+
+ x->n1 = argc;
+ memcpy(x->ap, argv, x->n1*sizeof(t_atom));
+
+ x->changed=0;
+
+ outlet_list(x->x_obj.ob_outlet, gensym("list"), x->n, x->ap);
+}
+
+static void glue_bang(t_glue *x)
+{
+ if (x->changed) {
+ if (x->n1+x->n2 != x->n){
+ t_atom *ap = (t_atom*)getbytes(sizeof(t_atom)*(x->n1+x->n2));
+ memcpy(ap, x->ap, x->n1*sizeof(t_atom));
+ freebytes(x->ap, sizeof(t_atom)*x->n);
+ x->ap=ap;
+ x->n=x->n1+x->n2;
+ }
+ memcpy(x->ap+x->n1, x->ap2, x->n2*sizeof(t_atom));
+ x->changed=0;
+ }
+
+ outlet_list(x->x_obj.ob_outlet, gensym("list"), x->n, x->ap);
+}
+
+static void glue_free(t_glue *x)
+{
+ freebytes(x->ap, sizeof(t_atom)*x->n);
+ freebytes(x->ap2, sizeof(t_atom)*x->n2);
+}
+
+static void *glue_new(t_symbol *s, int argc, t_atom *argv)
+{
+ t_glue *x = (t_glue *)pd_new(glue_class);
+
+ inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("list"), gensym(""));
+ outlet_new(&x->x_obj, 0);
+ x->n =x->n2 = 0;
+ x->ap=x->ap2 = 0;
+ x->changed = 0;
+
+ if (argc)glue_lst2(x, gensym("list"), argc, argv);
+
+ return (x);
+}
+
+void glue_setup(void)
+{
+ glue_class = class_new(gensym("glue"), (t_newmethod)glue_new,
+ (t_method)glue_free, sizeof(t_glue), 0, A_GIMME, 0);
+ class_addlist(glue_class, glue_lst);
+ class_addmethod (glue_class, (t_method)glue_lst2, gensym(""), A_GIMME, 0);
+ class_addbang(glue_class, glue_bang);
+
+ class_sethelpsymbol(glue_class, gensym("zexy/glue"));
+ zexy_register("glue");
+}
diff --git a/src/z_index.c b/src/index.c
index cee5b61..2f59f8e 100644
--- a/src/z_index.c
+++ b/src/index.c
@@ -1,3 +1,19 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
/*
(c) 2005:forum::für::umläute:2000
@@ -188,7 +204,7 @@ static void helper(t_index *x)
post("\ncreation:\"index [<maxelements> [<auto>]]\": creates a <maxelements> sized index");
}
-void z_index_setup(void)
+void index_setup(void)
{
index_class = class_new(gensym("index"),
(t_newmethod)index_new, (t_method)index_free,
@@ -206,4 +222,5 @@ void z_index_setup(void)
class_addmethod(index_class, (t_method)helper, gensym("help"), 0);
class_sethelpsymbol(index_class, gensym("zexy/index"));
+ zexy_register("index");
}
diff --git a/src/length.c b/src/length.c
new file mode 100644
index 0000000..9ed19e1
--- /dev/null
+++ b/src/length.c
@@ -0,0 +1,61 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ ******************************************************/
+
+/* length :: get the length of a list */
+
+
+#include "zexy.h"
+#include <math.h>
+
+#ifdef MACOSX
+#define sqrtf sqrt
+#endif
+
+
+static t_class *length_class;
+
+typedef struct _length
+{
+ t_object x_obj;
+} t_length;
+
+static void length_list(t_length *x, t_symbol *s, int argc, t_atom *argv)
+{
+ outlet_float(x->x_obj.ob_outlet, (t_float)argc);
+}
+static void length_any(t_length *x, t_symbol *s, int argc, t_atom *argv)
+{
+ outlet_float(x->x_obj.ob_outlet, (t_float)argc+1);
+}
+
+static void *length_new(void)
+{
+ t_length *x = (t_length *)pd_new(length_class);
+ outlet_new(&x->x_obj, gensym("float"));
+ return (x);
+}
+
+void length_setup(void)
+{
+ length_class = class_new(gensym("length"), (t_newmethod)length_new, 0,
+ sizeof(t_length), 0, A_DEFFLOAT, 0);
+
+ class_addlist(length_class, (t_method)length_list);
+ class_addanything(length_class, (t_method)length_any);
+ // class_addbang(length_class, (t_method)length_bang);
+
+ class_sethelpsymbol(length_class, gensym("zexy/length"));
+ zexy_register("length");
+}
diff --git a/src/z_limiter.c b/src/limiter_tilde.c
index 9f18efe..fbe6e69 100644
--- a/src/z_limiter.c
+++ b/src/limiter_tilde.c
@@ -1,3 +1,20 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
+
/*
--------------------------------- limiter/compressor ---------------------------------
@@ -14,7 +31,7 @@
2108:forum::für::umläute:1999 all rights reserved and no warranties...
- see GNU-license for details (shipped with pd)
+ see GNU-license for details
*/
#define LIMIT0 0
@@ -24,12 +41,6 @@
#include "zexy.h"
#include <math.h>
-#ifdef NT
-#define fabsf fabs
-#pragma warning( disable : 4244 )
-#pragma warning( disable : 4305 )
-#endif
-
#define LN2 .69314718056
#define SINC1 .822462987
#define SINC2 .404460777
@@ -164,7 +175,7 @@ static void set_mode(t_limiter *x, float mode)
x->mode = LIMIT0;
break;
}
- post("mode set to %d", x->mode);
+ // post("mode set to %d", x->mode);
}
static void set_LIMIT(t_limiter *x)
@@ -673,7 +684,7 @@ void limiter_free(t_limiter *x)
-void z_limiter_setup(void)
+void limiter_tilde_setup(void)
{
limiter_class = class_new(gensym("limiter~"), (t_newmethod)limiter_new, (t_method)limiter_free,
sizeof(t_limiter), 0, A_GIMME, 0);
@@ -704,4 +715,5 @@ void z_limiter_setup(void)
class_addmethod(limiter_class, (t_method)reset, gensym("reset"), 0);
+ zexy_register("limiter~");
}
diff --git a/src/list2int.c b/src/list2int.c
new file mode 100644
index 0000000..af14812
--- /dev/null
+++ b/src/list2int.c
@@ -0,0 +1,81 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
+/* 2305:forum::für::umläute:2001 */
+
+#include "zexy.h"
+#include <string.h>
+
+
+/* ------------------------- list2int ------------------------------- */
+
+/* cast each float of a list (or anything) to integer */
+
+static t_class *list2int_class;
+
+static void list2int_any(t_mypdlist *x, t_symbol *s, int argc, t_atom *argv)
+{
+ t_atom *ap;
+ if (x->x_n != argc) {
+ freebytes(x->x_list, x->x_n * sizeof(t_atom));
+ x->x_n = argc;
+ x->x_list = copybytes(argv, argc * sizeof(t_atom));
+ } else memcpy(x->x_list, argv, argc * sizeof(t_atom));
+ ap = x->x_list;
+ while(argc--){
+ if(ap->a_type == A_FLOAT)ap->a_w.w_float=(int)ap->a_w.w_float;
+ ap++;
+ }
+ outlet_anything(x->x_obj.ob_outlet, s, x->x_n, x->x_list);
+}
+static void list2int_bang(t_mypdlist *x)
+{ outlet_bang(x->x_obj.ob_outlet);}
+static void list2int_float(t_mypdlist *x, t_float f)
+{ outlet_float(x->x_obj.ob_outlet, (int)f);}
+static void list2int_symbol(t_mypdlist *x, t_symbol *s)
+{ outlet_symbol(x->x_obj.ob_outlet, s);}
+static void list2int_pointer(t_mypdlist *x, t_gpointer *p)
+{ outlet_pointer(x->x_obj.ob_outlet, p);}
+
+static void *list2int_new(t_symbol *s, int argc, t_atom *argv)
+{
+ t_mypdlist *x = (t_mypdlist *)pd_new(list2int_class);
+ outlet_new(&x->x_obj, 0);
+ x->x_n = 0;
+ x->x_list = 0;
+ return (x);
+}
+
+
+static void mypdlist_free(t_mypdlist *x)
+{
+ freebytes(x->x_list, x->x_n * sizeof(t_atom));
+}
+
+void list2int_setup(void)
+{
+ list2int_class = class_new(gensym("list2int"), (t_newmethod)list2int_new,
+ (t_method)mypdlist_free, sizeof(t_mypdlist), 0, A_GIMME, 0);
+ class_addcreator((t_newmethod)list2int_new, gensym("l2i"), A_GIMME, 0);
+ class_addanything(list2int_class, list2int_any);
+ class_addlist(list2int_class, list2int_any);
+ class_addbang(list2int_class, list2int_bang);
+ class_addfloat(list2int_class, list2int_float);
+ class_addsymbol(list2int_class, list2int_symbol);
+ class_addpointer(list2int_class, list2int_pointer);
+ class_sethelpsymbol(list2int_class, gensym("zexy/list2int"));
+ zexy_register("list2int");
+}
diff --git a/src/list2symbol.c b/src/list2symbol.c
new file mode 100644
index 0000000..cc40aa7
--- /dev/null
+++ b/src/list2symbol.c
@@ -0,0 +1,141 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
+#include "zexy.h"
+#include <stdlib.h>
+#include <string.h>
+
+/*
+ * list2symbol: convert a list into a single symbol
+*/
+
+/* ------------------------- list2symbol ------------------------------- */
+
+static t_class *list2symbol_class;
+
+typedef struct _list2symbol
+{
+ t_object x_obj;
+ int ac;
+ t_atom *ap;
+ t_symbol *s,*connector;
+} t_list2symbol;
+
+static void list2symbol_connector(t_list2symbol *x, t_symbol *s){
+ x->connector = s;
+}
+
+static void list2symbol_bang(t_list2symbol *x)
+{
+ t_atom *argv=x->ap;
+ int argc=x->ac;
+ char *result = 0;
+ int length = 0, len=0;
+ int i= argc;
+ char *connector=0;
+ char connlen=0;
+ if(x->connector)connector=x->connector->s_name;
+ if(connector)connlen=strlen(connector);
+
+ /* 1st get the length of the symbol */
+ if(x->s)length+=strlen(x->s->s_name);
+ else length-=connlen;
+
+ length+=i*connlen;
+
+ while(i--){
+ char buffer[MAXPDSTRING];
+ atom_string(argv++, buffer, MAXPDSTRING);
+ length+=strlen(buffer);
+ }
+
+ if (length<0){
+ outlet_symbol(x->x_obj.ob_outlet, gensym(""));
+ return;
+ }
+
+ result = (char*)getbytes((length+1)*sizeof(char));
+
+ /* 2nd create the symbol */
+ if (x->s){
+ char *buf = x->s->s_name;
+ strcpy(result+len, buf);
+ len+=strlen(buf);
+ if(i && connector){
+ strcpy(result+len, connector);
+ len += connlen;
+ }
+ }
+ i=argc;
+ argv=x->ap;
+ while(i--){
+ char buffer[MAXPDSTRING];
+ atom_string(argv++, buffer, MAXPDSTRING);
+ strcpy(result+len, buffer);
+ len += strlen(buffer);
+ if(i && connector){
+ strcpy(result+len, connector);
+ len += connlen;
+ }
+ }
+ result[length]=0;
+ outlet_symbol(x->x_obj.ob_outlet, gensym(result));
+ freebytes(result, (length+1)*sizeof(char));
+}
+
+static void list2symbol_anything(t_list2symbol *x, t_symbol *s, int argc, t_atom *argv)
+{
+ x->s =s;
+ x->ac=argc;
+ x->ap=argv;
+
+ list2symbol_bang(x);
+}
+
+static void list2symbol_list(t_list2symbol *x, t_symbol *s, int argc, t_atom *argv)
+{
+ list2symbol_anything(x, 0, argc, argv);
+}
+static void *list2symbol_new(t_symbol *s, int argc, t_atom *argv)
+{
+ t_list2symbol *x = (t_list2symbol *)pd_new(list2symbol_class);
+
+ outlet_new(&x->x_obj, 0);
+ inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("symbol"), gensym(""));
+ x->connector = gensym(" ");
+ list2symbol_anything(x, 0, argc, argv);
+
+ return (x);
+}
+
+static void list2symbol_free(t_list2symbol *x)
+{}
+
+
+void list2symbol_setup(void)
+{
+ list2symbol_class = class_new(gensym("list2symbol"), (t_newmethod)list2symbol_new,
+ (t_method)list2symbol_free, sizeof(t_list2symbol), 0, A_GIMME, 0);
+
+ class_addcreator((t_newmethod)list2symbol_new, gensym("l2s"), A_GIMME, 0);
+ class_addbang (list2symbol_class, list2symbol_bang);
+ class_addlist (list2symbol_class, list2symbol_list);
+ class_addanything(list2symbol_class, list2symbol_anything);
+ class_addmethod (list2symbol_class, (t_method)list2symbol_connector, gensym(""), A_SYMBOL, 0);
+
+ class_sethelpsymbol(list2symbol_class, gensym("zexy/list2symbol"));
+ zexy_register("list2symbol");
+}
diff --git a/src/lister.c b/src/lister.c
new file mode 100644
index 0000000..6e732ad
--- /dev/null
+++ b/src/lister.c
@@ -0,0 +1,84 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
+/* 2305:forum::für::umläute:2001 */
+
+
+#include "zexy.h"
+
+/* ------------------------- list ------------------------------- */
+
+/* this is for packages, what "float" is for floats */
+
+static t_class *mypdlist_class;
+
+static void mypdlist_secondlist(t_mypdlist *x, t_symbol *s, int argc, t_atom *argv)
+{
+ if (argc) {
+ if (x->x_n != argc) {
+ freebytes(x->x_list, x->x_n * sizeof(t_atom));
+ x->x_n = argc;
+ x->x_list = copybytes(argv, argc * sizeof(t_atom));
+ } else memcpy(x->x_list, argv, argc * sizeof(t_atom));
+ }
+}
+
+static void mypdlist_list(t_mypdlist *x, t_symbol *s, int argc, t_atom *argv)
+{
+ if (x->x_n != argc) {
+ freebytes(x->x_list, x->x_n * sizeof(t_atom));
+ x->x_n = argc;
+ x->x_list = copybytes(argv, argc * sizeof(t_atom));
+ } else memcpy(x->x_list, argv, argc * sizeof(t_atom));
+
+ outlet_list(x->x_obj.ob_outlet, gensym("list"), x->x_n, x->x_list);
+}
+static void mypdlist_bang(t_mypdlist *x)
+{ outlet_list(x->x_obj.ob_outlet, gensym("list"), x->x_n, x->x_list);}
+
+static void mypdlist_free(t_mypdlist *x)
+{ freebytes(x->x_list, x->x_n * sizeof(t_atom)); }
+
+static void *mypdlist_new(t_symbol *s, int argc, t_atom *argv)
+{
+ t_mypdlist *x = (t_mypdlist *)pd_new(mypdlist_class);
+
+ outlet_new(&x->x_obj, 0);
+ inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("list"), gensym("lst2"));
+
+ x->x_n = 0;
+ x->x_list = 0;
+
+ mypdlist_secondlist(x, gensym("list"), argc, argv);
+
+ return (x);
+}
+
+void lister_setup(void)
+{
+ mypdlist_class = class_new(gensym("lister"), (t_newmethod)mypdlist_new,
+ (t_method)mypdlist_free, sizeof(t_mypdlist), 0, A_GIMME, 0);
+ /* i don't know how to get this work with name=="list" !!! */
+
+ class_addcreator((t_newmethod)mypdlist_new, gensym("l"), A_GIMME, 0);
+
+ class_addbang (mypdlist_class, mypdlist_bang);
+ class_addlist (mypdlist_class, mypdlist_list);
+ class_addmethod (mypdlist_class, (t_method)mypdlist_secondlist, gensym("lst2"), A_GIMME, 0);
+
+ class_sethelpsymbol(mypdlist_class, gensym("zexy/lister"));
+ zexy_register("lister");
+}
diff --git a/src/z_lp.c b/src/lpt.c
index bb1cc54..a48ec07 100644
--- a/src/z_lp.c
+++ b/src/lpt.c
@@ -1,27 +1,87 @@
- /*
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
+/*
(c) 2000:forum::für::umläute:2004
write to the parallel port
extended to write to any port (if we do have permissions)
+
+ thanks to
+ Olaf Matthes: porting to WindozeNT/2000/XP
+ Thomas Musil: adding "control-output" and "input"
*/
+
#define BASE0 0x3bc
#define BASE1 0x378
#define BASE2 0x278
#define MODE_IOPERM 1
#define MODE_IOPL 0
+#define MODE_NONE -1
#include "zexy.h"
/* ----------------------- lpt --------------------- */
#ifdef Z_WANT_LPT
-# include <sys/io.h>
# include <stdlib.h>
-static int count_iopl = 0;
-#endif
+# ifdef NT
+/* on windoze everything is so complicated... */
+extern int read_parport(int port);
+extern void write_parport(int port, int value);
+extern int open_port(int port);
+static int ioperm(int port, int a, int b)
+{
+ if(open_port(port) == -1)return(1);
+ return(0);
+}
+
+static int iopl(int i)
+{
+ return(-1);
+}
+
+static void sys_outb(unsigned char byte, int port)
+{
+ write_parport(port, byte);
+}
+static int sys_inb(int port)
+{
+ return read_parport(port);
+}
+# else
+/* thankfully there is linux */
+# include <sys/io.h>
+
+static void sys_outb(unsigned char byte, int port)
+{
+ outb(byte, port);
+}
+static int sys_inb(int port)
+{
+ inb(port);
+}
+# endif /* NT */
+#endif /* Z_WANT_LP */
+
+
+static int count_iopl = 0;
static t_class *lpt_class;
typedef struct _lpt
@@ -38,19 +98,43 @@ static void lpt_float(t_lpt *x, t_floatarg f)
#ifdef Z_WANT_LPT
if (x->port) {
unsigned char b = f;
- outb(b, x->port);
+ sys_outb(b, x->port+0);
+ }
+#endif /* Z_WANT_LPT */
+}
+
+static void lpt_control(t_lpt *x, t_floatarg f)
+{
+#ifdef Z_WANT_LPT
+ if (x->port) {
+ unsigned char b = f;
+ sys_outb(b, x->port+2);
}
#endif /* Z_WANT_LPT */
}
+static void lpt_bang(t_lpt *x)
+{
+#ifdef Z_WANT_LPT
+ if (x->port) {
+ outlet_float(x->x_obj.ob_outlet, (float)sys_inb(x->port+1));
+ }
+#endif /* Z_WANT_LPT */
+}
+
+
static void *lpt_new(t_symbol *s, int argc, t_atom *argv)
{
t_lpt *x = (t_lpt *)pd_new(lpt_class);
if(s==gensym("lp"))
error("lpt: the use of 'lp' has been deprecated; use 'lpt' instead");
-#ifdef Z_WANT_LPT
+ inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"), gensym("control"));
+ outlet_new(&x->x_obj, gensym("float"));
+ x->mode = MODE_NONE;
x->port = 0;
+
+#ifdef Z_WANT_LPT
if ((argc==0)||(argv->a_type==A_FLOAT)) {
/* FLOAT specifies a parallel port */
@@ -85,22 +169,23 @@ static void *lpt_new(t_symbol *s, int argc, t_atom *argv)
if (x->port && x->port < 0x400){
if (ioperm(x->port, 8, 1)) {
- error("lpt : couldn't get write permissions");
- x->port = 0;
- return (x);
- }
- x->mode = MODE_IOPERM;
- } else {
+ x->mode=MODE_NONE;
+ } else x->mode = MODE_IOPERM;
+ }
+ if(x->mode==MODE_NONE){
if (iopl(3)){
- error("lpt : couldn't get write permissions");
- x->port = 0;
- return (x);
- }
- x->mode=MODE_IOPL;
+ x->mode=MODE_NONE;
+ } else x->mode=MODE_IOPL;
count_iopl++;
// post("iopl.............................%d", count_iopl);
}
+ if(x->mode==MODE_NONE){
+ error("lpt : couldn't get write permissions");
+ x->port = 0;
+ return (x);
+ }
+
post("connected to port %x in mode '%s'", x->port, (x->mode==MODE_IOPL)?"iopl":"ioperm");
if (x->mode==MODE_IOPL)post("warning: this might seriously damage your pc...");
#else
@@ -130,7 +215,7 @@ static void helper(t_lpt *x)
post("\t\t\"lpt <portaddr>\": connect to port @ <portaddr> (hex)");
}
-void z_lpt_setup(void)
+void lpt_setup(void)
{
lpt_class = class_new(gensym("lpt"),
(t_newmethod)lpt_new, (t_method)lpt_free,
@@ -138,11 +223,10 @@ void z_lpt_setup(void)
class_addcreator((t_newmethod)lpt_new, gensym("lp"), A_GIMME, 0);
class_addfloat(lpt_class, (t_method)lpt_float);
+ class_addmethod(lpt_class, (t_method)lpt_control, gensym("control"), A_FLOAT, 0);
+ class_addbang(lpt_class, (t_method)lpt_bang);
class_addmethod(lpt_class, (t_method)helper, gensym("help"), 0);
class_sethelpsymbol(lpt_class, gensym("zexy/lpt"));
-}
-
-void z_lp_setup(void){
- z_lpt_setup();
+ zexy_register("lpt");
}
diff --git a/src/makefile b/src/makefile
deleted file mode 100644
index f7b5ce8..0000000
--- a/src/makefile
+++ /dev/null
@@ -1,2 +0,0 @@
-current:
- ./configure && make
diff --git a/src/makefile.darwin b/src/makefile.darwin
deleted file mode 100644
index e29363e..0000000
--- a/src/makefile.darwin
+++ /dev/null
@@ -1,167 +0,0 @@
-current: all
-
-
-# the ZEXY-EXTERNAL-makefile
-# everything is GnuGPL that should come with the zexy.tgz
-# NO WARRANTIES FOR ANYTHING
-# et cetera
-# 1999:forum::für::umläute:2001
-
-# make sure that the "m_pd.h" is somehow available either by putting it into this
-# directory, by adding it's path to the INCLUDE-path or by putting it into an
-# already included path, e.g. "/usr/local/include/"
-
-#these are the user adjustables : adjust them to fit into your system
-# PD will install to $(DESTDIR)$(INSTALLL_PREFIX)$(PDLIBDIR), which is /usr/local/lib/pd
-# by default
-DESTDIR =
-INSTALL_PREFIX = /usr/local
-PDLIBDIR = /pd
-#these were the user adjustables
-
-CC=gcc
-
-TARGETS = zexy \
- z_connective z_pack z_multiplex z_drip \
- z_makesymbol z_strings \
- z_index z_msgfile \
- z_stat z_average z_sort \
- z_tabread4 z_coordinates \
- z_datetime z_lp \
- z_matrix \
- z_noise z_testfun \
- z_multiline z_sigmatrix \
- z_nop z_zdelay \
- z_limiter z_quantize z_swap \
- z_sigbin z_sigaverage \
- z_dfreq z_sigzero z_pdf \
- z_sfplay z_sfrecord \
- z_sigpack z_wrap \
- z_prime z_random \
- z_operating_system
-
-# ----------------------- MACOSX ----------------------------
-.SUFFIXES: .pd_darwin
-
-
-MACOSXOBJECTS = $(TARGETS:%=%.o)
-ARCH = $(shell uname --machine)
-
-PD_DIR = $(DESTDIR)$(INSTALL_PREFIX)$(PDLIBDIR)
-
-ifeq (${ARCH},alpha)
-AFLAGS = -mieee -mcpu=ev56
-endif
-
-LINCLUDE = -I../../../pd/src
-
-$(MACOSXOBJECTS): *.h
-
-CFLAGS = -O2 -DMACOSX -Dunix -g -Wall-W -Wno-unused \
- -Wno-parentheses -Wno-switch $(LINCLUDE) $(UCFLAGS) $(AFLAGS)
-
-#MACOSXLINKFLAGS = -bundle -undefined suppress -flat_namespace
-MACOSXLINKFLAGS = -bundle -bundle_loader ../../../pd/bin/pd
-
-everything: clean all install distclean
-
-distclean:
- touch dummy.o
- touch dummy.pd_darwin
- touch dummy~
- touch _dummy
- rm *.o *.pd_darwin *~ _*
-
-clean:
- touch dummy.o
- touch dummy.pd_darwin
- rm *.o *.pd_darwin
-
-all: $(MACOSXOBJECTS)
-
- @echo :: $(MACOSXOBJECTS)
-
- $(CC) $(MACOSXLINKFLAGS) -o zexy.pd_darwin *.o -lc -lm
-# strip -x zexy.pd_darwin
-
-.c.pd_darwin:
- $(CC) $(CFLAGS) -DPD $(INCLUDE) -c -o $*.o $*.c
-
-install: installdocs
- install -m 644 zexy.pd_darwin $(PD_DIR)/extra
-
-installdocs:
- install -d $(PD_DIR)/doc/5.reference/zexy
- install -m644 ../examples/*.* $(PD_DIR)/doc/5.reference/zexy
-
-
-# added by Hans-Christoph Steiner <hans@eds.org>
-# to generate MacOS X packages
-
-ZEXY_VERSION = $(shell grep VERSION zexy.h | cut -d ' ' -f 3 | cut -d '"' -f 2)
-PACKAGE_PREFIX = pd-zexy
-PACKAGE_NAME = $(PACKAGE_PREFIX)-$(ZEXY_VERSION)
-
-darwin_pkg_license:
- # generate HTML version of License
- echo "<HTML><BODY><FONT SIZE="-1">" > License.html
- cat ../../creb/COPYING | sed -e 's/^$$/\<P\>/g' >> License.html
- echo "</FONT></BODY></HTML>" >> License.html
-
-darwin_pkg_welcome:
-# generate Welcome.html from ../README.txt
-# echo "<HTML><BODY><FONT SIZE="-1">" > ../Welcome.html
-# head -11 ../README.txt >> ../Welcome.html
-# sed -i -e 's/the zexy external/\<B\>the zexy external\<\/B\>/' ../Welcome.html
-# sed -i -e 's/^$$/\<P\>/' ../Welcome.html
-# echo "</FONT></BODY></HTML>" >> ../Welcome.html
- head -11 ../README.txt >> Welcome.txt
-
-darwin_pkg_clean:
- -sudo rm -Rf installroot/ $(PACKAGE_PREFIX)*.pkg/
- -rm -f ../$(PACKAGE_PREFIX)-*.info 1 License.html Welcome.???*
-
-
-# install into MSP's default: /usr/local/lib
-
-HELP_DIR = installroot/pd/doc/5.reference/help-zexy
-darwin_pkg: all darwin_pkg_clean darwin_pkg_license darwin_pkg_welcome
-# set up installroot dir
- test -d $(HELP_DIR) || mkdir -p $(HELP_DIR)
- install -m444 ../zexy.pd $(HELP_DIR)/..
- install -d $(HELP_DIR)/help-zexy
- install -m444 ../examples/*.* $(HELP_DIR)
- test -d installroot/pd/extra || mkdir -p installroot/pd/extra
- install -m444 *.pd_darwin installroot/pd/extra
- cp -f ../pd-zexy.info ../$(PACKAGE_NAME).info
-# delete cruft
- -find installroot -name .DS_Store -delete
- -rm -f 1
-# set proper permissions
- sudo chown -R root:staff installroot
- package installroot ../$(PACKAGE_NAME).info -d . -ignoreDSStore
-# install pkg docs
- install -m 644 License.html Welcome.txt $(PACKAGE_NAME).pkg/Contents/Resources
- sudo chown -R root:staff $(PACKAGE_NAME).pkg/Contents/Resources
-
-
-# install into MacOS X style paths: /Library/Pd
-
-darwin_altpkg: all darwin_pkg_clean darwin_pkg_license darwin_pkg_welcome
-# set up installroot dir
- test -d installroot/Help || mkdir -p installroot/Help
- -cp ../examples/* installroot/Help
- test -d installroot/Externals || mkdir -p installroot/Externals
- install -m444 *.pd_darwin installroot/Externals
- sed -e 's/\/usr\/local\/lib/\/Library\/Pd/' ../pd-zexy.info \
- | sed -e 's/MSP standard paths/MacOS X-style Paths/' \
- > ../$(PACKAGE_NAME)-alt.info
- # delete cruft
- -find installroot -name .DS_Store -delete
- -rm -f 1
- # set proper permissions
- sudo chown -R root:staff installroot
- package installroot ../$(PACKAGE_NAME)-alt.info -d . -ignoreDSStore
- # install pkg docs
- install -m 444 License.html Welcome.txt $(PACKAGE_NAME)-alt.pkg/Contents/Resources
- sudo chown -R root:staff $(PACKAGE_NAME)-alt.pkg/Contents/Resources
diff --git a/src/makefile.irix b/src/makefile.irix
deleted file mode 100644
index b644cf1..0000000
--- a/src/makefile.irix
+++ /dev/null
@@ -1,29 +0,0 @@
-current: irix5
-
-TARGETS = zexy \
- z_sfplay z_sfrecord \
- z_noise z_testfun \
- z_limiter \
- z_dfreq z_sigbin \
- z_sigzero z_pdf z_average \
- z_nop z_zdelay z_swap z_quantize \
- z_makesymbol z_tabread4 \
- z_datetime z_index \
- z_connective z_sigpack z_sort \
- z_multiplex z_drip z_pack \
-
-SGI5OBJECTS = $(TARGETS:%=%.pd_irix5)
-
-# ----------------------- IRIX ----------------------------
-.SUFFIXES: .pd_irix5
-SGIINCLUDE = -I../../src
-
-irix5: $(SGIOBJECTS)
-
-.c.pd_irix5:
- cc -g -w2 -fullwarn -mips2 -DFTS $(SGIINCLUDE) -c $*.c
- ld -elf -shared -rdata_shared -o $*.pd_irix5 $*.o
- rm $*.o
-
-clean::
- rm *.o obj/* *.pd_irix5 so_locations rm *.pd_linux *~
diff --git a/src/makefile.linux b/src/makefile.linux
deleted file mode 100644
index eda19ca..0000000
--- a/src/makefile.linux
+++ /dev/null
@@ -1,94 +0,0 @@
-current: all
-
-
-# the ZEXY-EXTERNAL-makefile
-# everything is GnuGPL that should come with the zexy.tgz
-# NO WARRANTIES FOR ANYTHING
-# et cetera
-# 1999:forum::für::umläute:2003
-
-# make sure that the "m_pd.h" is somehow available either by putting it into this
-# directory, by adding it's path to the INCLUDE-path or by putting it into an
-# already included path, e.g. "/usr/local/include/"
-
-#these are the user adjustables : adjust them to fit into your system
-# PD will install to $(DESTDIR)$(INSTALLL_PREFIX)$(PDLIBDIR), which is /usr/local/lib/pd
-# by default
-DESTDIR =
-INSTALL_PREFIX = /usr/local
-PDLIBDIR = /lib/pd
-#these were the user adjustables
-
-
-TARGETS = zexy \
- z_connective z_pack z_multiplex z_drip \
- z_makesymbol z_strings \
- z_index z_msgfile \
- z_stat z_average z_sort \
- z_tabread4 z_coordinates \
- z_datetime z_lp \
- z_matrix \
- z_noise z_testfun \
- z_multiline z_sigmatrix \
- z_nop z_zdelay \
- z_limiter z_quantize z_swap \
- z_sigbin z_sigaverage \
- z_dfreq z_sigzero z_pdf \
- z_sfplay z_sfrecord \
- z_sigpack \
- z_prime z_random z_wrap \
- z_operating_system
-
-# ----------------------- LINUX ----------------------------
-.SUFFIXES: .pd_linux
-
-
-LINUXOBJECTS = $(TARGETS:%=%.o)
-ARCH = $(shell uname --machine)
-
-PD_DIR = $(DESTDIR)$(INSTALL_PREFIX)$(PDLIBDIR)
-
-ifeq (${ARCH},alpha)
-AFLAGS = -mieee -mcpu=ev56
-endif
-
-LINCLUDE = -I../../../pd/src
-
-$(LINUXOBJECTS): *.h
-
-CFLAGS = -O2 -g -Wall $(LINCLUDE) $(UCFLAGS) $(AFLAGS)
-#CFLAGS = -O3 -march=pentium3 -g -Wall $(LINCLUDE) $(UCFLAGS) $(AFLAGS)
-
-
-everything: clean all install distclean
-
-distclean:
- touch dummy.o
- touch dummy.pd_linux
- touch dummy~
- touch _dummy
- rm *.o *.pd_linux *~ _*
-
-clean:
- touch dummy.o
- touch dummy.pd_linux
- rm *.o *.pd_linux
-
-all: $(LINUXOBJECTS)
-
- @echo :: $(LINUXOBJECTS)
-
- ld -export_dynamic -shared -o zexy.pd_linux *.o -lc -lm
- strip --strip-unneeded zexy.pd_linux
-
-.c.pd_linux:
- cc $(CFLAGS) -O2 -DPD -fPIC $(INCLUDE) -c -o $*.o $*.c
-
-
-install: installdocs
- install -d $(PD_DIR)/extra
- install -m 644 zexy.pd_linux $(PD_DIR)/extra
-
-installdocs:
- install -d $(PD_DIR)/doc/5.reference/zexy
- install -m644 ../examples/*.pd $(PD_DIR)/doc/5.reference/zexy
diff --git a/src/makefile.nt b/src/makefile.nt
deleted file mode 100755
index 0489002..0000000
--- a/src/makefile.nt
+++ /dev/null
@@ -1,30 +0,0 @@
-all: zexy.dll
-
-SRCS = z_average.c z_connective.c z_coordinates.c z_datetime.c z_dfreq.c z_drip.c z_index.c z_limiter.c z_lp.c z_makesymbol.c z_matrix.c z_msgfile.c z_multiline.c z_multiplex.c z_noise.c z_nop.c z_operating_system.c z_pack.c z_pdf.c z_prime.c z_quantize.c z_random.c z_sfplay.c z_sfrecord.c z_sigaverage.c z_sigbin.c z_sigmatrix.c z_sigpack.c z_sigzero.c z_sort.c z_stat.c z_strings.c z_swap.c z_tabread4.c z_testfun.c z_wrap.c z_zdelay.c zexy.c
-
-NTOBJETS = $(SRCS:.c=.obj)
-
-NTDLLS = *.dll
-
-PDNTCFLAGS = /DNT /DMSW /DPD /nologo
-
-PDNTINCLUDE = /I. /I..\..\..\src
-
-PDNTLDIR = "c:\program\vc2003\lib"
-
-PDNTLIB = $(PDNTLDIR)\libc.lib \
- $(PDNTLDIR)\oldnames.lib \
- $(PDNTLDIR)\wsock32.lib \
- $(PDNTLDIR)\kernel32.lib \
- $(PDNTLDIR)\uuid.lib \
- ..\..\..\bin\pd.lib
-
-.c.obj:
- cl /c $(PDNTCFLAGS) $(PDNTINCLUDE) $*.c
-
-zexy.dll: $(NTOBJETS)
- -link /dll /out:zexy.dll /export:zexy_setup $(PDNTLIB) $(NTOBJETS)
-
-clean:
- del *.obj
- del *.dll
diff --git a/src/makefile.win b/src/makefile.win
deleted file mode 100755
index 820c17c..0000000
--- a/src/makefile.win
+++ /dev/null
@@ -1,58 +0,0 @@
-current: all
-prefix=../../..
-
-# the ZEXY-EXTERNAL-makefile
-# everything is GnuGPL that should come with the zexy.tgz
-# NO WARRANTIES FOR ANYTHING
-# et cetera
-# 1999:forum::für::umläute:2003
-
-TARGETS = zexy \
- z_connective z_pack z_multiplex z_drip \
- z_makesymbol z_strings \
- z_index z_msgfile \
- z_stat z_average z_sort \
- z_tabread4 z_coordinates \
- z_datetime \
- z_matrix \
- z_noise z_testfun \
- z_multiline z_sigmatrix \
- z_nop z_zdelay \
- z_limiter z_quantize z_swap \
- z_sigbin z_sigaverage \
- z_dfreq z_sigzero z_pdf \
- z_sfplay z_sfrecord \
- z_sigpack \
- z_prime z_random z_wrap \
- z_operating_system
-
-.SUFFIXES: .dll
-
-OBJECTS = $(TARGETS:%=%.o)
-
-INCLUDE = -I. -I$(prefix)/src
-
-$(OBJECTS): *.h
-
-CFLAGS = -DNT -Wall -W -Wshadow -Wstrict-prototypes -Wno-unused -Wno-parentheses -Wno-switch $(INCLUDE)
-
-everything: clean all install
-
-clean:
- -rm *.dll *.o
-
-all: $(OBJECTS)
-
- @echo :: $(OBJECTS)
- gcc -shared -o zexy.dll *.o $(prefix)/bin/pd.dll
-
-.c.pd_linux:
- cc $(CFLAGS) -O2 -DPD -fPIC $(INCLUDE) -c -o $*.o $*.c
-
-install: installdocs
- @test -d $(prefix)/extra || mkdir -p $(prefix)/extra
- install *.dll $(prefix)/extra
-
-installdocs:
- install -d $(prefix)/doc/5.reference/zexy
- install -m644 ../examples/*.pd $(prefix)/doc/5.reference/zexy
diff --git a/src/makesource.sh b/src/makesource.sh
new file mode 100755
index 0000000..d2c527e
--- /dev/null
+++ b/src/makesource.sh
@@ -0,0 +1,68 @@
+#!/bin/sh
+
+ZEXY_H=z_zexy.h
+ZEXY_C=z_zexy.c
+ZEXY_S=Make.source
+
+function head_h() {
+ echo "/* zexy-setup autogenerated header-file"
+ echo " * generated by \"$0\""
+ echo " * !! DO NOT MANUALLY EDIT !!"
+ echo " */"
+ echo
+ echo "#ifndef Z_ZEXY_H__"
+ echo "#define Z_ZEXY_H__"
+}
+
+function foot_h() {
+ echo "#endif /* Z_ZEXY_H__ */"
+ echo ""
+}
+
+function head_c() {
+ echo "/* zexy-setup autogenerated setup-file"
+ echo " * generated by \"$0\""
+ echo " * !! DO NOT MANUALLY EDIT !!"
+ echo " */"
+ echo
+ echo "#include \"$ZEXY_H\""
+ echo
+ echo "void z_zexy_setup(void)"
+ echo "{"
+}
+
+function foot_c() {
+ echo "}"
+ echo
+}
+
+function head_s() {
+ echo "SOURCES = \\"
+}
+
+function foot_s() {
+ echo " zexy.c"
+ echo
+}
+
+head_h > $ZEXY_H
+head_c > $ZEXY_C
+head_s > $ZEXY_S
+
+for i in `ls *.c | grep -v zexy.c`
+do
+ NAME="${i%.c}"
+ SETUPNAME="void ${NAME}_setup(void)"
+ if grep "$SETUPNAME" $i > /dev/null
+ then
+# echo ${i%.c}
+ echo " $i \\" >> $ZEXY_S
+ echo "$SETUPNAME;" >> $ZEXY_H
+ echo " ${NAME}_setup();" >> $ZEXY_C
+ fi
+done
+
+foot_h >> $ZEXY_H
+foot_c >> $ZEXY_C
+foot_s >> $ZEXY_S
+
diff --git a/src/z_makesymbol.c b/src/makesymbol.c
index 89ba95f..662089a 100644
--- a/src/z_makesymbol.c
+++ b/src/makesymbol.c
@@ -1,3 +1,20 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
+
/*
(l) 1210:forum::für::umläute:1999
@@ -46,6 +63,8 @@ t_symbol* list2symbol(char *masque, int argc, t_atom *argv)
cstring buffer;
int i;
+ for(i=0; i<MAXSTRINGARGS; i++)*buf[i]=0;
+
for (i=0; i<argc; i++) {
atom_string(argv+i, buf[i], MAXSTRINGLENG);
}
@@ -110,7 +129,7 @@ static void helper(t_makesymbol *x)
post("\n\nmasq = %s", x->mask);
}
-void z_makesymbol_setup(void)
+void makesymbol_setup(void)
{
makesymbol_class = class_new(gensym("makesymbol"),
(t_newmethod)makesymbol_new, (t_method)makesymbol_free,
@@ -123,4 +142,5 @@ void z_makesymbol_setup(void)
class_addmethod(makesymbol_class, (t_method)helper, gensym("help"), 0);
class_sethelpsymbol(makesymbol_class, gensym("zexy/makesymbol"));
+ zexy_register("makesymbol");
}
diff --git a/src/z_average.c b/src/mavg.c
index f0c2fd9..2ed0352 100644
--- a/src/z_average.c
+++ b/src/mavg.c
@@ -1,11 +1,21 @@
-#include "zexy.h"
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
-#ifdef NT
-#pragma warning( disable : 4244 )
-#pragma warning( disable : 4305 )
-#endif
-/* ------------------------ average ----------------------------- */
+#include "zexy.h"
/* mavg :: moving average filter */
@@ -90,7 +100,7 @@ static void mavg_help(void)
post("mavg\t:: moving average filter");
}
-static void mavg_setup(void)
+void mavg_setup(void)
{
mavg_class = class_new(gensym("mavg"), (t_newmethod)mavg_new, 0,
sizeof(t_mavg), 0, A_DEFFLOAT, 0);
@@ -102,12 +112,5 @@ static void mavg_setup(void)
class_addmethod(mavg_class, (t_method)mavg_resize, gensym(""), A_DEFFLOAT, 0);
class_sethelpsymbol(mavg_class, gensym("zexy/mavg"));
-}
-
-
-/* global setup routine */
-
-void z_average_setup(void)
-{
- mavg_setup();
+ zexy_register("mavg");
}
diff --git a/src/minmax.c b/src/minmax.c
new file mode 100644
index 0000000..f96b025
--- /dev/null
+++ b/src/minmax.c
@@ -0,0 +1,84 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
+#include "zexy.h"
+
+/* minmax :: get minimum and maximum of a list */
+
+static t_class *minmax_class;
+
+typedef struct _minmax
+{
+ t_object x_obj;
+ t_float min;
+ t_float max;
+
+ t_outlet *mino, *maxo;
+} t_minmax;
+
+static void minmax_bang(t_minmax *x)
+{
+ outlet_float(x->maxo,x->max);
+ outlet_float(x->mino,x->min);
+}
+
+static void minmax_list(t_minmax *x, t_symbol *s, int argc, t_atom *argv)
+{
+ t_float min = atom_getfloat(argv++);
+ t_float max=min;
+ argc--;
+
+ while(argc--){
+ t_float f = atom_getfloat(argv++);
+ if (f<min)min=f;
+ else if (f>max)max=f;
+ }
+
+ x->min=min;
+ x->max=max;
+
+ minmax_bang(x);
+}
+
+static void *minmax_new(void)
+{
+ t_minmax *x = (t_minmax *)pd_new(minmax_class);
+
+ x->mino=outlet_new(&x->x_obj, gensym("float"));
+ x->maxo=outlet_new(&x->x_obj, gensym("float"));
+
+ x->min = x->max = 0;
+
+ return (x);
+}
+
+static void minmax_help(void)
+{
+ post("minmax\t:: get minimum and maximum of a list of floats");
+}
+
+void minmax_setup(void)
+{
+ minmax_class = class_new(gensym("minmax"), (t_newmethod)minmax_new, 0,
+ sizeof(t_minmax), 0, A_DEFFLOAT, 0);
+
+ class_addlist(minmax_class, (t_method)minmax_list);
+ class_addbang(minmax_class, (t_method)minmax_bang);
+ class_addmethod(minmax_class, (t_method)minmax_help, gensym("help"), 0);
+
+ class_sethelpsymbol(minmax_class, gensym("zexy/minmax"));
+ zexy_register("minmax");
+}
diff --git a/src/z_msgfile.c b/src/msgfile.c
index 706ed60..a059fd5 100644
--- a/src/z_msgfile.c
+++ b/src/msgfile.c
@@ -1,10 +1,24 @@
-/* Copyright 1997-1998 Regents of the University of California.
-Permission is granted to use this software for any noncommercial purpose.
-For commercial licensing contact the UCSD Technology Transfer Office.
-
-UC MAKES NO WARRANTY, EXPRESS OR IMPLIED, IN CONNECTION WITH THIS SOFTWARE!
-
-Written by Miller Puckette (msp@ucsd.edu)
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
+
+/*
+ this is heavily based on code from [textfile],
+ which is part of pd and written by Miller S. Pucket
+ pd (and thus [textfile]) come with their own license
*/
#include "zexy.h"
@@ -740,7 +754,7 @@ static void *msgfile_new(t_symbol *s, int argc, t_atom *argv)
return (x);
}
-static void msgfile_setup(void)
+void msgfile_setup(void)
{
msgfile_class = class_new(gensym("msgfile"), (t_newmethod)msgfile_new,
(t_method)msgfile_free, sizeof(t_msgfile), 0, A_GIMME, 0);
@@ -782,10 +796,5 @@ static void msgfile_setup(void)
class_addmethod(msgfile_class, (t_method)msgfile_help, gensym("help"), 0);
class_sethelpsymbol(msgfile_class, gensym("zexy/msgfile"));
+ zexy_register("msgfile");
}
-
-void z_msgfile_setup(void)
-{
- msgfile_setup();
-}
-
diff --git a/src/z_multiline.c b/src/multiline_tilde.c
index 9226ba1..2767df5 100644
--- a/src/z_multiline.c
+++ b/src/multiline_tilde.c
@@ -1,3 +1,19 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
/*
a multiline that MULTIplicates MULTIple signals with "ramped floats" (--> like "line~")
@@ -16,12 +32,6 @@
#include "zexy.h"
-#ifdef NT
-#pragma warning( disable : 4244 )
-#pragma warning( disable : 4305 )
-#endif
-
-
/* --------------------------- multiline~ ---------------------------------- */
static t_class *mline_class;
@@ -237,7 +247,7 @@ static void *mline_new(t_symbol *s, int argc, t_atom *argv)
-void z_multiline_setup(void)
+void multiline_tilde_setup(void)
{
mline_class = class_new(gensym("multiline~"), (t_newmethod)mline_new, (t_method)mline_free,
sizeof(t_mline), 0, A_GIMME, 0);
@@ -249,4 +259,5 @@ void z_multiline_setup(void)
class_addmethod(mline_class, (t_method)mline_stop, gensym("stop"), 0);
class_sethelpsymbol(mline_class, gensym("zexy/multiline~"));
+ zexy_register("multiline_tilde");
}
diff --git a/src/multiplex.c b/src/multiplex.c
new file mode 100644
index 0000000..571db96
--- /dev/null
+++ b/src/multiplex.c
@@ -0,0 +1,106 @@
+
+/* 1903:forum::für::umläute:2005 */
+
+/*
+ * mulitplex : multiplex a specified input to the output
+ *
+ * THINK: should the selector-inlet be the first or the last ???
+ * pros/cons:
+ * the 1st inlet being the selector is not consistant with pd (hot/cold)
+ * but as it since the hot inlet is selectable, the whole object is not really consitant
+ * numbering would have to start with 1 (for the 1st not-leftmost inlet)
+ * if the selector is rightmost this would mean: cold is right(most), hot is (somewhere) left
+ * numbering would be ok
+ *
+ * conclusio: make the selector rightmost
+ *
+ */
+
+#include "zexy.h"
+#include <stdio.h>
+
+
+/* ------------------------- mux ------------------------------- */
+
+/*
+ a multiplexer
+*/
+
+static t_class *mux_class;
+static t_class *muxproxy_class;
+
+typedef struct _mux
+{
+ t_object x_obj;
+ struct _muxproxy **x_proxy;
+
+ int i_count;
+ int i_selected;
+ t_inlet **in;
+} t_mux;
+
+
+typedef struct _muxproxy
+{
+ t_object p_ob;
+ t_mux *p_master;
+ int id;
+} t_muxproxy;
+
+static void mux_select(t_mux *x, t_float f)
+{
+ x->i_selected=f;
+}
+
+static void mux_anything(t_muxproxy *y, t_symbol *s, int argc, t_atom *argv)
+{
+ t_mux*x=y->p_master;
+ if(y->id==x->i_selected)
+ outlet_anything(x->x_obj.ob_outlet, s, argc, argv);
+}
+
+static void *mux_new(t_symbol *s, int argc, t_atom *argv)
+{
+ int n = (argc < 2)?2:argc;
+ t_mux *x = (t_mux *)pd_new(mux_class);
+ // t_muxproxy *y=(t_muxproxy*)pd_new(muxproxy_class);
+ x->x_proxy = (t_muxproxy**)getbytes(sizeof(t_muxproxy*));
+
+ x->i_selected=0;
+ x->i_count = n;
+ x->in = (t_inlet **)getbytes(x->i_count * sizeof(t_inlet *));
+
+ for (n = 0; n<x->i_count; n++) {
+ x->x_proxy[n]=(t_muxproxy*)pd_new(muxproxy_class);
+ x->x_proxy[n]->p_master = x;
+ x->x_proxy[n]->id=n;
+ x->in[n] = inlet_new ((t_object*)x, (t_pd*)x->x_proxy[n], 0,0);
+ }
+
+ inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"), gensym(""));
+
+ outlet_new(&x->x_obj, 0);
+ return (x);
+}
+
+static void mux_free(t_mux*x){
+
+}
+
+void multiplex_setup(void)
+{
+ mux_class = class_new(gensym("multiplex"), (t_newmethod)mux_new,
+ (t_method)mux_free, sizeof(t_mux), CLASS_NOINLET, A_GIMME, 0);
+ class_addcreator((t_newmethod)mux_new, gensym("mux"), A_GIMME, 0);
+
+ class_addmethod (mux_class, (t_method)mux_select, gensym(""), A_DEFFLOAT, 0);
+
+ muxproxy_class = class_new(gensym("mux proxy"), 0, 0,
+ sizeof(t_muxproxy),
+ CLASS_PD | CLASS_NOINLET, 0);
+ class_addanything(muxproxy_class, mux_anything);
+
+ class_sethelpsymbol(mux_class, gensym("zexy/multiplex"));
+
+ zexy_register("multiplex");
+}
diff --git a/src/multiplex_tilde.c b/src/multiplex_tilde.c
new file mode 100644
index 0000000..be141cd
--- /dev/null
+++ b/src/multiplex_tilde.c
@@ -0,0 +1,112 @@
+/******************************************************
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
+#include "zexy.h"
+
+
+/* ------------------------------------------------------------------------------ */
+
+/* mux~ : multiplex a specified signal to the output */
+
+static t_class *mux_class;
+
+typedef struct _mux {
+ t_object x_obj;
+
+ int input;
+
+ int n_in;
+ t_float **in;
+} t_mux;
+
+static void mux_input(t_mux *x, t_floatarg f)
+{
+ if ((f>=0)&&(f<x->n_in)){
+ x->input=f;
+ } else
+ error("multiplex: %d is channel out of range (0..%d)", (int)f, x->n_in);
+
+}
+
+static t_int *mux_perform(t_int *w)
+{
+ t_mux *x = (t_mux *)(w[1]);
+ t_float *out = (t_float *)(w[2]);
+ int n = (int)(w[3]);
+
+ t_float *in = x->in[x->input];
+
+ while(n--)*out++=*in++;
+
+ return (w+4);
+}
+
+static void mux_dsp(t_mux *x, t_signal **sp)
+{
+ int n = 0;
+ t_float **dummy=x->in;
+
+ for(n=0;n<x->n_in;n++)*dummy++=sp[n]->s_vec;
+
+ dsp_add(mux_perform, 3, x, sp[n]->s_vec, sp[0]->s_n);
+}
+
+static void mux_helper(void)
+{
+ post("\n%c mux~\t:: multiplex a one of various signals to one outlet", HEARTSYMBOL);
+ post("<#out>\t : the inlet-number (counting from 0) witch is routed to the outlet"
+ "'help'\t : view this");
+ post("creation : \"mux~ [arg1 [arg2...]]\"\t: the number of arguments equals the number of inlets\n");
+}
+
+static void mux_free(t_mux *x)
+{
+ freebytes(x->in, x->n_in * sizeof(t_float *));
+}
+
+static void *mux_new(t_symbol *s, int argc, t_atom *argv)
+{
+ t_mux *x = (t_mux *)pd_new(mux_class);
+ int i;
+
+ if (!argc)argc=2;
+ x->n_in=argc;
+ x->input=0;
+
+ argc--;
+ while(argc--)inlet_new(&x->x_obj,&x->x_obj.ob_pd,&s_signal,&s_signal);
+
+ x->in = (t_float **)getbytes(x->n_in * sizeof(t_float *));
+ i=x->n_in;
+ while(i--)x->in[i]=0;
+
+ outlet_new(&x->x_obj, gensym("signal"));
+
+ return (x);
+}
+
+void multiplex_tilde_setup(void)
+{
+ mux_class = class_new(gensym("multiplex~"), (t_newmethod)mux_new, (t_method)mux_free, sizeof(t_mux), 0, A_GIMME, 0);
+ class_addcreator((t_newmethod)mux_new, gensym("mux~"), A_GIMME, 0);
+
+ class_addfloat(mux_class, mux_input);
+ class_addmethod(mux_class, (t_method)mux_dsp, gensym("dsp"), 0);
+ class_addmethod(mux_class, nullfn, gensym("signal"), 0);
+
+ class_addmethod(mux_class, (t_method)mux_helper, gensym("help"), 0);
+ class_sethelpsymbol(mux_class, gensym("zexy/multiplex~"));
+ zexy_register("multiplex~");
+}
diff --git a/src/niagara.c b/src/niagara.c
new file mode 100644
index 0000000..5764952
--- /dev/null
+++ b/src/niagara.c
@@ -0,0 +1,110 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
+/* 3108:forum::für::umläute:2000 */
+
+#include "zexy.h"
+#include <string.h>
+#include <memory.h>
+
+
+/* ------------------------- niagara ------------------------------- */
+
+/*
+divides a package into 2 sub-packages at a specified point
+like the niagara-falls, some water goes down to the left side, the rest to the right side, devided by the rock
+*/
+
+static t_class *niagara_class;
+
+typedef struct _niagara
+{
+ t_object x_obj;
+ t_float rock;
+ t_outlet *left, *right;
+} t_niagara;
+
+static void niagara_list(t_niagara *x, t_symbol *s, int argc, t_atom *argv)
+{
+ int n_l, n_r;
+ t_atom *ap_l, *ap_r;
+ int dumrock = x->rock;
+ int rock = ((dumrock < 0.f)?(argc+dumrock):dumrock);
+
+ n_l = (rock < argc)?rock:argc;
+ ap_l = argv;
+
+ n_r = argc - n_l;
+ ap_r = &argv[n_l];
+
+ if (n_r) outlet_list(x->right, s, n_r, ap_r);
+ if (n_l) outlet_list(x->left, s, n_l, ap_l);
+}
+
+static void niagara_any(t_niagara *x, t_symbol *s, int argc, t_atom *argv)
+{
+ int n_l, n_r;
+ t_atom *ap_l, *ap_r;
+ t_symbol *s_r, *s_l;
+ int dumrock = x->rock;
+ int rock = ((dumrock < 0.f)?(argc+dumrock):dumrock-1);
+
+ n_l = (rock < argc)?rock:argc;
+ ap_l = argv;
+ s_l = s;
+
+ n_r = argc - n_l;
+ ap_r = &argv[n_l];
+
+ if (n_r) {
+ s_r = 0;
+ if (ap_r->a_type == A_FLOAT) s_r = gensym("list");
+ else {
+ s_r = atom_getsymbol(ap_r);
+ ap_r++;
+ n_r--;
+ }
+ outlet_anything(x->right, s_r, n_r, ap_r);
+ }
+
+ if (n_l+1 ) outlet_anything(x->left, s_l, n_l, ap_l);
+}
+
+static void *niagara_new(t_floatarg f)
+{
+ t_niagara *x = (t_niagara *)pd_new(niagara_class);
+
+ x->rock = f;
+
+ x->left = outlet_new(&x->x_obj, &s_list);
+ x->right = outlet_new(&x->x_obj, &s_list);
+
+ floatinlet_new(&x->x_obj, &x->rock);
+
+ return (x);
+}
+
+void niagara_setup(void)
+{
+ niagara_class = class_new(gensym("niagara"), (t_newmethod)niagara_new,
+ 0, sizeof(t_niagara), 0, A_DEFFLOAT, 0);
+
+ class_addlist (niagara_class, niagara_list);
+ class_addanything(niagara_class, niagara_any);
+
+ class_sethelpsymbol(niagara_class, gensym("zexy/niagara"));
+ zexy_register("niagara");
+}
diff --git a/src/noish_tilde.c b/src/noish_tilde.c
new file mode 100644
index 0000000..6374242
--- /dev/null
+++ b/src/noish_tilde.c
@@ -0,0 +1,184 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
+/*
+ 30041999
+
+ two bandlimited noise gnerators based on DODGE/JERSE "computer music" c3.9 : RANDI & RANDH
+
+ I do not care for copyrights
+ (all in all, the used noise~-code (in fact, the pseude-random-code) is from Miller Puckette
+ and I made only very few modifications so look out for the LICENSE.TXT delivered with
+ puredata for further (c)-information
+
+ forum für umläute 1999
+
+ this is in fact the very same as the late "NOISE.C", except that I tried to optimize the code a little bit
+ (by partially removing those very expensive if..then's in about 15 minutes, so there are thousands of new bugs very likely)
+
+ 14071999
+ finally added changing seeds, this is to prevent to noise~-units to output the very same, something quite unnatural even for pseudo-random-noise
+*/
+
+#include "zexy.h"
+
+/* general */
+
+typedef struct _nois
+{
+ t_object x_obj;
+ int val;
+ t_float current;
+ t_float decrement;
+ t_float updater;
+ t_float to_go;
+} t_nois;
+
+
+static void set_freq(t_nois *x, t_floatarg freq)
+{
+ x->updater = (freq > 0) ? sys_getsr() / freq : 1;
+ if (x->updater < 1)
+ {
+ x->updater = 1;
+ }
+ x->to_go = 0;
+}
+
+
+/* ------------------------ noish~ ----------------------------- */
+
+static t_class *noish_class;
+
+static t_int *noish_perform(t_int *w)
+{
+ t_nois *x = (t_nois *)(w[1]);
+ t_float *out = (t_float *)(w[2]);
+ int n = (int)(w[3]);
+
+ int *vp = (int *)(&x->val);
+ int i_value = *vp;
+ t_float f_value = ((float)((i_value & 0x7fffffff) - 0x40000000)) *
+ (float)(1.0 / 0x40000000);
+ t_float all_to_go = x->updater;
+ t_float still_to_go = x->to_go;
+
+ if (all_to_go == 1)
+ { /* this is "pure white" noise, so we have to calculate each sample */
+ while (n--)
+ {
+ i_value *= 435898247;
+ i_value += 382842987;
+ *out++ = ((float)((i_value & 0x7fffffff) - 0x40000000)) * (float)(1.0 / 0x40000000);
+ }
+ }
+ else
+ if (n < still_to_go)
+ { /* signal won't change for the next 64 samples */
+ still_to_go -= n;
+ while (n--)
+ {
+ *out++ = f_value;
+ }
+ }
+ else
+ if (all_to_go + still_to_go > n)
+ { /* only one update calculation necessary for 64 samples !!! */
+ while (still_to_go-- > 0)
+ {
+ n--;
+ *out++ = f_value;
+ }
+
+ still_to_go += all_to_go + 1;
+
+ i_value *= 435898247;
+ i_value += 382842987;
+ f_value = ( (float)((i_value & 0x7fffffff) - 0x40000000) ) * (float)(1.0 / 0x40000000);
+
+ while (n--)
+ {
+ still_to_go--;
+ *out++ = f_value;
+ }
+ }
+ else
+ { /* anything else */
+ while (n--)
+ {
+ if (still_to_go-- <= 0) /* update only if all time has elapsed */
+ {
+ still_to_go += all_to_go;
+
+ i_value *= 435898247;
+ i_value += 382842987;
+
+ f_value = ( (float)((i_value & 0x7fffffff) - 0x40000000) ) * (float)(1.0 / 0x40000000);
+ }
+ *out++ = f_value;
+ }
+ }
+
+
+ *vp = i_value;
+ x->updater = all_to_go;
+ x->to_go = still_to_go;
+
+ return (w+4);
+}
+
+static void noish_dsp(t_nois *x, t_signal **sp)
+{
+ post("sr=%f\nsn=%f", sp[0]->s_sr, sp[0]->s_n);
+ dsp_add(noish_perform, 3, x, sp[0]->s_vec, sp[0]->s_n);
+}
+
+static void noish_helper(void)
+{
+ post("\n%c noish~\t:: a bandlimited pseudo-noise generator", HEARTSYMBOL);
+ post("<freq>\t : sampling-frequency (in Hz)\n"
+ "'help'\t : view this");
+ post("creation : \"noish~ [<freq>]\"\t: ('0'(default) will produce 'white' noise)\n");
+ post("note\t : the seed of the pseudo-noise generator changes from\n"
+ "\t instance to instance, so two noish~-objects created at the\n"
+ "\t same time will produce dífferent signals, something the original\n"
+ "\t noise~-object misses\n");
+ post("for further details see DODGE/JERSE \"computer music\" c3.9\n");
+}
+
+static void *noish_new(t_floatarg f)
+{
+ t_nois *x = (t_nois *)pd_new(noish_class);
+
+ static int init = 307;
+ x->val = (init *= 13);
+
+ set_freq(x, f);
+
+ outlet_new(&x->x_obj, gensym("signal"));
+ return (x);
+}
+
+void noish_tilde_setup(void)
+{
+ noish_class = class_new(gensym("noish~"), (t_newmethod)noish_new, 0, sizeof(t_nois), 0, A_DEFFLOAT, 0);
+
+ class_addfloat(noish_class, set_freq);
+ class_addmethod(noish_class, (t_method)noish_dsp, gensym("dsp"), 0);
+
+ class_addmethod(noish_class, (t_method)noish_helper, gensym("help"), 0);
+ class_sethelpsymbol(noish_class, gensym("zexy/noish~"));
+}
diff --git a/src/z_noise.c b/src/noisi_tilde.c
index 9d555bd..14fb1be 100644
--- a/src/z_noise.c
+++ b/src/noisi_tilde.c
@@ -1,3 +1,19 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
/*
30041999
@@ -18,10 +34,6 @@
*/
#include "zexy.h"
-#ifdef NT
-#pragma warning( disable : 4244 )
-#pragma warning( disable : 4305 )
-#endif
/* general */
@@ -36,7 +48,7 @@ typedef struct _nois
} t_nois;
-static void set_freq(t_nois *x, t_floatarg freq)
+static void set_noisfreq(t_nois *x, t_floatarg freq)
{
x->updater = (freq > 0) ? sys_getsr() / freq : 1;
if (x->updater < 1)
@@ -46,133 +58,6 @@ static void set_freq(t_nois *x, t_floatarg freq)
x->to_go = 0;
}
-
-/* ------------------------ noish~ ----------------------------- */
-
-static t_class *noish_class;
-
-static t_int *noish_perform(t_int *w)
-{
- t_nois *x = (t_nois *)(w[1]);
- t_float *out = (t_float *)(w[2]);
- int n = (int)(w[3]);
-
- int *vp = (int *)(&x->val);
- int i_value = *vp;
- t_float f_value = ((float)((i_value & 0x7fffffff) - 0x40000000)) *
- (float)(1.0 / 0x40000000);
- t_float all_to_go = x->updater;
- t_float still_to_go = x->to_go;
-
- if (all_to_go == 1)
- { /* this is "pure white" noise, so we have to calculate each sample */
- while (n--)
- {
- i_value *= 435898247;
- i_value += 382842987;
- *out++ = ((float)((i_value & 0x7fffffff) - 0x40000000)) * (float)(1.0 / 0x40000000);
- }
- }
- else
- if (n < still_to_go)
- { /* signal won't change for the next 64 samples */
- still_to_go -= n;
- while (n--)
- {
- *out++ = f_value;
- }
- }
- else
- if (all_to_go + still_to_go > n)
- { /* only one update calculation necessary for 64 samples !!! */
- while (still_to_go-- > 0)
- {
- n--;
- *out++ = f_value;
- }
-
- still_to_go += all_to_go + 1;
-
- i_value *= 435898247;
- i_value += 382842987;
- f_value = ( (float)((i_value & 0x7fffffff) - 0x40000000) ) * (float)(1.0 / 0x40000000);
-
- while (n--)
- {
- still_to_go--;
- *out++ = f_value;
- }
- }
- else
- { /* anything else */
- while (n--)
- {
- if (still_to_go-- <= 0) /* update only if all time has elapsed */
- {
- still_to_go += all_to_go;
-
- i_value *= 435898247;
- i_value += 382842987;
-
- f_value = ( (float)((i_value & 0x7fffffff) - 0x40000000) ) * (float)(1.0 / 0x40000000);
- }
- *out++ = f_value;
- }
- }
-
-
- *vp = i_value;
- x->updater = all_to_go;
- x->to_go = still_to_go;
-
- return (w+4);
-}
-
-static void noish_dsp(t_nois *x, t_signal **sp)
-{
- post("sr=%f\nsn=%f", sp[0]->s_sr, sp[0]->s_n);
- dsp_add(noish_perform, 3, x, sp[0]->s_vec, sp[0]->s_n);
-}
-
-static void noish_helper(void)
-{
- post("\n%c noish~\t:: a bandlimited pseudo-noise generator", HEARTSYMBOL);
- post("<freq>\t : sampling-frequency (in Hz)\n"
- "'help'\t : view this");
- post("creation : \"noish~ [<freq>]\"\t: ('0'(default) will produce 'white' noise)\n");
- post("note\t : the seed of the pseudo-noise generator changes from\n"
- "\t instance to instance, so two noish~-objects created at the\n"
- "\t same time will produce dífferent signals, something the original\n"
- "\t noise~-object misses\n");
- post("for further details see DODGE/JERSE \"computer music\" c3.9\n");
-}
-
-static void *noish_new(t_floatarg f)
-{
- t_nois *x = (t_nois *)pd_new(noish_class);
-
- static int init = 307;
- x->val = (init *= 13);
-
- set_freq(x, f);
-
- outlet_new(&x->x_obj, gensym("signal"));
- return (x);
-}
-
-void noish_setup(void)
-{
- noish_class = class_new(gensym("noish~"), (t_newmethod)noish_new, 0, sizeof(t_nois), 0, A_DEFFLOAT, 0);
-
- class_addfloat(noish_class, set_freq);
- class_addmethod(noish_class, (t_method)noish_dsp, gensym("dsp"), 0);
-
- class_addmethod(noish_class, (t_method)noish_helper, gensym("help"), 0);
- class_sethelpsymbol(noish_class, gensym("zexy/noish~"));
-}
-
-
-
/* ------------------------ noisi~ ----------------------------- */
static t_class *noisi_class;
@@ -265,25 +150,18 @@ static void *noisi_new(t_floatarg f){
static int init = 4259;
x->val = (init *= 17);
- set_freq (x, f);
+ set_noisfreq (x, f);
outlet_new(&x->x_obj, gensym("signal"));
return (x);
}
-void noisi_setup(void){
+void noisi_tilde_setup(void){
noisi_class = class_new(gensym("noisi~"), (t_newmethod)noisi_new, 0, sizeof(t_nois), 0, A_DEFFLOAT, 0);
- class_addfloat(noisi_class, set_freq);
+ class_addfloat(noisi_class, set_noisfreq);
class_addmethod(noisi_class, (t_method)noisi_dsp, gensym("dsp"), 0);
class_addmethod(noisi_class, (t_method)noisi_helper, gensym("help"), 0);
class_sethelpsymbol(noisi_class, gensym("zexy/noisi~"));
}
-
-/* global setup routine */
-
-void z_noise_setup(void){
- noish_setup();
- noisi_setup();
-}
diff --git a/src/z_operating_system.c b/src/operating_system.c
index fdac649..bea6156 100644
--- a/src/z_operating_system.c
+++ b/src/operating_system.c
@@ -1,5 +1,18 @@
-
-/* 1008:forum::für::umläute:2001 */
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
/*
operating_system : operating_system-code for message-objects
@@ -42,11 +55,12 @@ static void *operating_system_new(t_floatarg f)
return (x);
}
-void z_operating_system_setup(void)
+void operating_system_setup(void)
{
operating_system_class = class_new(gensym("operating_system"), (t_newmethod)operating_system_new,
0, sizeof(t_operating_system), 0, A_DEFFLOAT, 0);
class_addbang (operating_system_class, operating_system_bang);
class_sethelpsymbol(operating_system_class, gensym("zexy/operating_system"));
+ zexy_register("operating_system");
}
diff --git a/src/pack_tilde.c b/src/pack_tilde.c
new file mode 100644
index 0000000..ca762c9
--- /dev/null
+++ b/src/pack_tilde.c
@@ -0,0 +1,86 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
+#include "zexy.h"
+
+
+/* ------------------------ pack~ ----------------------------- */
+/* pack the signal-vector to a float-package */
+
+static t_class *sigpack_class;
+
+typedef struct _sigpack
+{
+ t_object x_obj;
+
+ int vector_length;
+ t_atom *buffer;
+
+} t_sigpack;
+
+static t_int *sigpack_perform(t_int *w)
+{
+ t_float *in = (t_float *)(w[1]);
+ t_sigpack *x = (t_sigpack *)w[2];
+ int n = (int)(w[3]), i = 0;
+ t_atom *buf = x->buffer;
+
+ while (n--) {
+ SETFLOAT(&buf[i], *in++);
+ i++;
+ }
+ outlet_list(x->x_obj.ob_outlet, &s_list, x->vector_length, x->buffer);
+
+ return (w+4);
+}
+
+static void sigpack_dsp(t_sigpack *x, t_signal **sp)
+{
+ if (x->vector_length != sp[0]->s_n) {
+ freebytes(x->buffer, x->vector_length * sizeof(t_atom));
+ x->vector_length = sp[0]->s_n;
+ x->buffer = (t_atom *)getbytes(x->vector_length * sizeof(t_atom));
+ }
+ dsp_add(sigpack_perform, 3, sp[0]->s_vec, x, sp[0]->s_n);
+}
+
+static void *sigpack_new(void)
+{
+ t_sigpack *x = (t_sigpack *)pd_new(sigpack_class);
+ x->vector_length = 0;
+ x->buffer = 0;
+ outlet_new(&x->x_obj, gensym("list"));
+
+ return (x);
+}
+
+static void sigpack_help(void)
+{
+ post("pack~\t:: outputs the signal-vectors as float-packages");
+}
+
+void pack_tilde_setup(void)
+{
+ sigpack_class = class_new(gensym("pack~"), (t_newmethod)sigpack_new, 0,
+ sizeof(t_sigpack), 0, A_DEFFLOAT, 0);
+ class_addmethod(sigpack_class, nullfn, gensym("signal"), 0);
+ class_addmethod(sigpack_class, (t_method)sigpack_dsp, gensym("dsp"), 0);
+
+ class_addmethod(sigpack_class, (t_method)sigpack_help, gensym("help"), 0);
+ class_sethelpsymbol(sigpack_class, gensym("zexy/pack~"));
+
+ zexy_register("pack~");
+}
diff --git a/src/packel.c b/src/packel.c
new file mode 100644
index 0000000..67c5211
--- /dev/null
+++ b/src/packel.c
@@ -0,0 +1,107 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
+
+/* 3108:forum::für::umläute:2000 */
+
+/* ------------------------- packel ------------------------------- */
+
+/*
+ get the nth element of a package
+*/
+
+#include "zexy.h"
+#include <string.h>
+// do we need memory.h ?
+#include <memory.h>
+
+
+static t_class *packel_class;
+
+typedef struct _packel
+{
+ t_object x_obj;
+ t_float position;
+} t_packel;
+
+static void packel_list(t_packel *x, t_symbol *s, int argc, t_atom *argv)
+{
+ int mypos = x->position;
+
+ if (mypos) {
+ t_atom *current;
+ int pos = (mypos < 0)?(argc+mypos):(mypos-1);
+
+ if(argc==0){
+ if (pos==0||pos==-1)outlet_bang(x->x_obj.ob_outlet);
+ return;
+ }
+
+ if (pos < 0 || pos >= argc)return;
+
+ current = &(argv[pos]);
+
+ switch (current->a_type) {
+ case A_FLOAT:
+ outlet_float(x->x_obj.ob_outlet, atom_getfloat(current));
+ break;
+ case A_SYMBOL:
+ outlet_symbol(x->x_obj.ob_outlet, atom_getsymbol(current));
+ break;
+ case A_POINTER:
+ outlet_pointer(x->x_obj.ob_outlet, current->a_w.w_gpointer);
+ break;
+ case A_NULL:
+ outlet_bang(x->x_obj.ob_outlet);
+ default:
+ ;
+ }
+ } else outlet_list(x->x_obj.ob_outlet, s, argc, argv);
+}
+
+static void packel_anything(t_packel *x, t_symbol *s, int argc, t_atom *argv)
+{
+ t_atom *av2 = (t_atom *)getbytes((argc + 1) * sizeof(t_atom));
+ int i;
+
+ for (i = 0; i < argc; i++)
+ av2[i + 1] = argv[i];
+ SETSYMBOL(av2, s);
+ packel_list(x, gensym("list"), argc+1, av2);
+ freebytes(av2, (argc + 1) * sizeof(t_atom));
+}
+
+static void *packel_new(t_floatarg f)
+{
+ t_packel *x = (t_packel *)pd_new(packel_class);
+ outlet_new(&x->x_obj, 0);
+ floatinlet_new(&x->x_obj, &x->position);
+ x->position = (int) f;
+
+ return (x);
+}
+
+void packel_setup(void)
+{
+ packel_class = class_new(gensym("packel"), (t_newmethod)packel_new,
+ 0, sizeof(t_packel), 0, A_DEFFLOAT, 0);
+
+ class_addlist (packel_class, packel_list);
+ class_addanything(packel_class, packel_anything);
+
+ class_sethelpsymbol(packel_class, gensym("zexy/packel"));
+ zexy_register("packel");
+}
diff --git a/src/z_pdf.c b/src/pdf_tilde.c
index dc6fbfe..e55bcf0 100644
--- a/src/z_pdf.c
+++ b/src/pdf_tilde.c
@@ -1,12 +1,23 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
/* get the ProbabilityDensityFunction of a signal */
#include "zexy.h"
-#ifdef NT
-#pragma warning( disable : 4244 )
-#pragma warning( disable : 4305 )
-#endif
-
/* ------------------------ pdf~ ----------------------------- */
static t_class *pdf_class;
@@ -111,7 +122,7 @@ static void helper(void)
post("creation :: 'pdf~ [<n>]':: get the pdf for <n> (default: 64) values");
}
-void z_pdf_setup(void)
+void pdf_tilde_setup(void)
{
pdf_class = class_new(gensym("pdf~"), (t_newmethod)pdf_new, (t_method)pdf_free,
sizeof(t_pdf), 0, A_DEFFLOAT, 0);
@@ -125,4 +136,5 @@ void z_pdf_setup(void)
class_addmethod(pdf_class, (t_method)helper, gensym("help"), 0);
class_sethelpsymbol(pdf_class, gensym("zexy/pdf~"));
+ zexy_register("pdf~");
}
diff --git a/src/z_prime.c b/src/prime.c
index 6d0f100..2277019 100644
--- a/src/z_prime.c
+++ b/src/prime.c
@@ -1,3 +1,21 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
+/* get the n-th prime number */
+
#include "zexy.h"
#include <math.h>
@@ -46,11 +64,12 @@ void *prime_new(void)
return (void *)x;
}
-void z_prime_setup(void) {
+void prime_setup(void) {
prime_class = class_new(gensym("prime"),
(t_newmethod)prime_new,
0, sizeof(t_prime),
CLASS_DEFAULT, 0);
class_addfloat(prime_class, prime_float);
+ zexy_register("prime");
}
diff --git a/src/z_quantize.c b/src/quantize_tilde.c
index a66c1eb..15190e6 100644
--- a/src/z_quantize.c
+++ b/src/quantize_tilde.c
@@ -1,15 +1,28 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
+
/*
- the long waited for quantize~-object that quantizes in many possible (but equal) steps
- of course, we´ll make a comfortable quantize of the float-signal for 16bit and 8bit
+ the long waited for quantize~-object that quantizes in many possible (but equal) steps
+ of course, we´ll make a comfortable quantize of the float-signal for 16bit and 8bit
- 1110:forum::für::umläute:1999
- */
+ 1110:forum::für::umläute:1999
+*/
#include "zexy.h"
-#ifdef NT
-#pragma warning( disable : 4244 )
-#pragma warning( disable : 4305 )
-#endif
/* ------------------------ quantize~ ----------------------------- */
@@ -83,17 +96,18 @@ static void *quantize_new(t_floatarg f)
return (x);
}
-void z_quantize_setup(void)
+void quantize_tilde_setup(void)
{
- quantize_class = class_new(gensym("quantize~"), (t_newmethod)quantize_new, 0,
- sizeof(t_quantize), 0, A_DEFFLOAT, 0);
- class_addmethod(quantize_class, nullfn, gensym("signal"), 0);
- class_addmethod(quantize_class, (t_method)quantize_dsp, gensym("dsp"), 0);
-
- class_addfloat(quantize_class, quantize_float);
- class_addmethod(quantize_class, (t_method)quantize_8bit, gensym("8bit"), 0);
- class_addmethod(quantize_class, (t_method)quantize_16bit, gensym("16bit"), 0);
-
- class_addmethod(quantize_class, (t_method)helper, gensym("help"), 0);
- class_sethelpsymbol(quantize_class, gensym("zexy/quantize~"));
+ quantize_class = class_new(gensym("quantize~"), (t_newmethod)quantize_new, 0,
+ sizeof(t_quantize), 0, A_DEFFLOAT, 0);
+ class_addmethod(quantize_class, nullfn, gensym("signal"), 0);
+ class_addmethod(quantize_class, (t_method)quantize_dsp, gensym("dsp"), 0);
+
+ class_addfloat(quantize_class, quantize_float);
+ class_addmethod(quantize_class, (t_method)quantize_8bit, gensym("8bit"), 0);
+ class_addmethod(quantize_class, (t_method)quantize_16bit, gensym("16bit"), 0);
+
+ class_addmethod(quantize_class, (t_method)helper, gensym("help"), 0);
+ class_sethelpsymbol(quantize_class, gensym("zexy/quantize~"));
+ zexy_register("quantize~");
}
diff --git a/src/repack.c b/src/repack.c
new file mode 100644
index 0000000..c7b527b
--- /dev/null
+++ b/src/repack.c
@@ -0,0 +1,182 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
+/* 3108:forum::für::umläute:2000 */
+
+/* objects for manipulating packages*/
+
+/*
+ repack : (re)pack floats/symbols/pointers to fixed-length packages
+*/
+
+#include "zexy.h"
+#include <string.h>
+#include <memory.h>
+
+
+/* -------------------- repack ------------------------------ */
+
+/*
+(re)pack a sequence of (packages of) atoms into a package of given length
+
+"bang" gives out the current package immediately
+the second inlet lets you change the default package size
+*/
+
+static t_class *repack_class;
+
+typedef struct _repack
+{
+ t_object x_obj;
+ t_atom *buffer;
+ int bufsize;
+
+ int outputsize;
+ int current;
+} t_repack;
+
+
+static void repack_set(t_repack *x, t_float f)
+{
+ /* set the new default size */
+ int n = f;
+
+ if (n > 0) {
+
+ /* flush all the newsized packages that are in the buffer */
+ t_atom *dumbuf = x->buffer;
+ int dumcur = x->current;
+
+ while (n <= dumcur) {
+ outlet_list(x->x_obj.ob_outlet, gensym("list"), n, dumbuf);
+ dumcur -= n;
+ dumbuf += n;
+ }
+
+ if (dumcur < 0) error("this should never happen :: dumcur = %d < 0", dumcur);
+ else {
+ memcpy(x->buffer, dumbuf, dumcur * sizeof(t_atom));
+ x->current = dumcur;
+ }
+
+ if (n > x->bufsize) {
+ dumbuf = (t_atom *)getbytes(n * sizeof(t_atom));
+ memcpy(dumbuf, x->buffer, x->current * sizeof(t_atom));
+ freebytes(x->buffer, x->bufsize * sizeof(t_atom));
+ x->buffer = dumbuf;
+ x->bufsize = n;
+ }
+
+ x->outputsize = n;
+ }
+}
+
+static void repack_bang(t_repack *x)
+{
+ /* output the list as far as we are now */
+ outlet_list(x->x_obj.ob_outlet, gensym("list"), x->current, x->buffer);
+ x->current = 0;
+}
+
+static void repack_float(t_repack *x, t_float f)
+{
+ /* add a float-atom to the list */
+ SETFLOAT(&x->buffer[x->current], f);
+ x->current++;
+ if (x->current >= x->outputsize) repack_bang(x);
+}
+
+static void repack_symbol(t_repack *x, t_symbol *s)
+{
+ /* add a sym-atom to the list */
+ SETSYMBOL(&x->buffer[x->current], s);
+ x->current++;
+ if (x->current >= x->outputsize) repack_bang(x);
+}
+static void repack_pointer(t_repack *x, t_gpointer *p)
+{
+ /* add a pointer-atom to the list */
+ SETPOINTER(&x->buffer[x->current], p);
+ x->current++;
+ if (x->current >= x->outputsize) repack_bang(x);
+}
+static void repack_list(t_repack *x, t_symbol *s, int argc, t_atom *argv)
+{
+ int remain = x->outputsize - x->current;
+ t_atom *ap = argv;
+
+ if (argc >= remain) {
+ memcpy(x->buffer+x->current, ap, remain * sizeof(t_atom));
+ ap += remain;
+ argc -= remain;
+ outlet_list(x->x_obj.ob_outlet, gensym("list"), x->outputsize, x->buffer);
+ x->current = 0;
+ }
+
+ while (argc >= x->outputsize) {
+ outlet_list(x->x_obj.ob_outlet, gensym("list"), x->outputsize, ap);
+ ap += x->outputsize;
+ argc -= x->outputsize;
+ }
+
+ memcpy(x->buffer + x->current, ap, argc * sizeof(t_atom));
+ x->current += argc;
+}
+static void repack_anything(t_repack *x, t_symbol *s, int argc, t_atom *argv)
+{
+ SETSYMBOL(&x->buffer[x->current], s);
+ x->current++;
+
+ if (x->current >= x->outputsize) {
+ repack_bang(x);
+ }
+ repack_list(x, gensym("list"), argc, argv);
+}
+
+static void *repack_new(t_floatarg f)
+{
+ t_repack *x = (t_repack *)pd_new(repack_class);
+
+
+
+ x->outputsize = x->bufsize = (f>0.f)?f:2 ;
+ x->current = 0;
+
+
+ x->buffer = (t_atom *)getbytes(x->bufsize * sizeof(t_atom));
+
+ inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"), gensym(""));
+ outlet_new(&x->x_obj, 0);
+
+ return (x);
+}
+
+void repack_setup(void)
+{
+ repack_class = class_new(gensym("repack"), (t_newmethod)repack_new,
+ 0, sizeof(t_repack), 0, A_DEFFLOAT, 0);
+
+ class_addbang (repack_class, repack_bang);
+ class_addfloat (repack_class, repack_float);
+ class_addsymbol (repack_class, repack_symbol);
+ class_addpointer (repack_class, repack_pointer);
+ class_addlist (repack_class, repack_list);
+ class_addanything(repack_class, repack_anything);
+ class_addmethod (repack_class, (t_method)repack_set, gensym(""), A_DEFFLOAT, 0);
+
+ class_sethelpsymbol(repack_class, gensym("zexy/repack"));
+ zexy_register("repack");
+}
diff --git a/src/repeat.c b/src/repeat.c
new file mode 100644
index 0000000..dbeedc7
--- /dev/null
+++ b/src/repeat.c
@@ -0,0 +1,60 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
+/* 2305:forum::für::umläute:2001 */
+
+/* connective objects */
+
+#include "zexy.h"
+
+/* ------------------------- repeat ------------------------------- */
+
+/* a no-operation - just pass through what you get in */
+
+static t_class *repeat_class;
+
+typedef struct _repeat
+{
+ t_object x_obj;
+ t_float fcount;
+} t_repeat;
+
+static void repeat_anything(t_repeat *x, t_symbol *s, int argc, t_atom *argv)
+{
+ int i;
+ i=x->fcount;
+ if (i<0)i=1;
+ while(i--)outlet_anything(x->x_obj.ob_outlet, s, argc, argv);
+}
+
+static void *repeat_new(t_float f)
+{
+ t_repeat *x = (t_repeat *)pd_new(repeat_class);
+ x->fcount = f;
+ floatinlet_new(&x->x_obj, &x->fcount);
+ outlet_new(&x->x_obj, 0);
+ return (x);
+}
+
+void repeat_setup(void)
+{
+ repeat_class = class_new(gensym("repeat"), (t_newmethod)repeat_new,
+ 0, sizeof(t_repeat), 0, A_FLOAT, 0);
+ class_addanything(repeat_class, repeat_anything);
+
+ class_sethelpsymbol(repeat_class, gensym("zexy/repeat"));
+ zexy_register("repeat");
+}
diff --git a/src/z_sfplay.c b/src/sfplay.c
index 39ed4b9..fd3a884 100644
--- a/src/z_sfplay.c
+++ b/src/sfplay.c
@@ -1,3 +1,19 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
/*
sfplay.c - Author: Winfried Ritsch - IEM Graz 10.Mai 99 -
Modified:
@@ -632,7 +648,7 @@ static void sfplay_free(t_sfplay *x)
freebytes(x->filep, DACBLKSIZE*sizeof(short)*x->x_channels);
}
-void z_sfplay_setup(void)
+void sfplay_setup(void)
{
sfplay_class = class_new(gensym("sfplay"), (t_newmethod)sfplay_new, (t_method)sfplay_free,
sizeof(t_sfplay), 0, A_DEFFLOAT, A_DEFFLOAT,0);
@@ -655,4 +671,5 @@ void z_sfplay_setup(void)
class_addfloat(sfplay_class, sfplay_float);
/* start with bang */
class_addbang(sfplay_class,sfplay_bang);
+ zexy_register("sfplay");
}
diff --git a/src/z_sfrecord.c b/src/sfrecord.c
index f7eed96..2aa9515 100644
--- a/src/z_sfrecord.c
+++ b/src/sfrecord.c
@@ -1,3 +1,19 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
/*
sfplay.c - Author: Winfried Ritsch - IEM Graz 10.Mai 99 -
Modified:
@@ -8,7 +24,7 @@ ritsch@iem.kug.ac.at
zmoelnig@iem.kug.ac.at
*/
-/* to do :: add headers for wav, aiff etc files */
+/* TODO: deprecate this in favour of [sfplay~] */
/* #define DEBUG_ME // for debugging messages */
@@ -566,7 +582,7 @@ static void sfrecord_free(t_sfrecord *x)
freebytes(x->filep, DACBLKSIZE*sizeof(short)*x->x_channels);
}
-void z_sfrecord_setup(void)
+void sfrecord_setup(void)
{
sfrecord_class = class_new(gensym("sfrecord"), (t_newmethod)sfrecord_new, (t_method)sfrecord_free,
sizeof(t_sfrecord), 0, A_DEFFLOAT, A_DEFFLOAT,0);
@@ -589,4 +605,5 @@ void z_sfrecord_setup(void)
/* some help */
class_addmethod(sfrecord_class, (t_method)helper, gensym("help"), A_NULL);
class_sethelpsymbol(sfrecord_class, gensym("zexy/sf-play_record"));
+ zexy_register("sfrecord");
}
diff --git a/src/z_sigzero.c b/src/sigzero_tilde.c
index a3f0790..de9584d 100644
--- a/src/z_sigzero.c
+++ b/src/sigzero_tilde.c
@@ -1,8 +1,17 @@
-#include "zexy.h"
-#ifdef NT
-#pragma warning( disable : 4244 )
-#pragma warning( disable : 4305 )
-#endif
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ ******************************************************/
/* ------------------------ sigzero~ ----------------------------- */
/*
@@ -10,6 +19,7 @@
this is really great together with the "switch~"-object
*/
+#include "zexy.h"
static t_class *sigzero_class;
@@ -84,7 +94,7 @@ static void *sigzero_new(t_symbol s)
return (x);
}
-void z_sigzero_setup(void)
+void sigzero_tilde_setup(void)
{
sigzero_class = class_new(gensym("sigzero~"), (t_newmethod)sigzero_new, 0,
sizeof(t_sigzero), 0, 0);
@@ -97,4 +107,5 @@ void z_sigzero_setup(void)
class_addmethod(sigzero_class, (t_method)helper, gensym("help"), 0);
class_sethelpsymbol(sigzero_class, gensym("zexy/sigzero~"));
+ zexy_register("sigzero~");
}
diff --git a/src/z_sort.c b/src/sort.c
index 633d128..97a7dd3 100644
--- a/src/z_sort.c
+++ b/src/sort.c
@@ -1,3 +1,18 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ ******************************************************/
+
/* 1309:forum::für::umläute:2000 */
@@ -102,7 +117,7 @@ static void *sort_new(t_floatarg f)
return (x);
}
-void z_sort_setup(void)
+void sort_setup(void)
{
sort_class = class_new(gensym("sort"), (t_newmethod)sort_new,
0, sizeof(t_sort), 0, A_DEFFLOAT, 0);
@@ -111,4 +126,5 @@ void z_sort_setup(void)
class_addmethod (sort_class, (t_method)sort_dir, gensym("direction"), A_DEFFLOAT, 0);
class_sethelpsymbol(sort_class, gensym("zexy/sort"));
+ zexy_register("sort");
}
diff --git a/src/z_testfun.c b/src/step_tilde.c
index 57d8f20..f1200e7 100644
--- a/src/z_testfun.c
+++ b/src/step_tilde.c
@@ -1,7 +1,19 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ ******************************************************/
+
/*
-This external makes the two main test-functions available :
-dirac~ : will make a single peak (eg: a 1 in all the 0s) at a desired position in the signal-vector
- the position can be passed as an argument when creating the object
step~ : will make a unity step at a desired point in the signal-vector; the second input specifies a
length: after the so-specified time has elapsed, the step will toggle back to the previous
value;
@@ -14,95 +26,9 @@ NOTE : the inlets do NOT specify any times but sample-NUMBERS; there are 64 samp
*/
#include "zexy.h"
-#ifdef NT
-#pragma warning( disable : 4244 )
-#pragma warning( disable : 4305 )
-#endif
-
-/* ------------------------ dirac~ ----------------------------- */
-
-
-static t_class *dirac_class;
-
-typedef struct _dirac
-{
- t_object x_obj;
- t_float position;
- t_float do_it;
-} t_dirac;
-
-static void dirac_bang(t_dirac *x)
-{
- x->do_it = x->position;
-}
-
-static void dirac_float(t_dirac *x, t_float where)
-{
- x->do_it = x->position = where;
-}
-
-static t_int *dirac_perform(t_int *w)
-{
- t_dirac *x = (t_dirac *)(w[1]);
- t_float *out = (t_float *)(w[2]);
- int n = (int)(w[3]);
-
- int do_it = x->do_it;
-
- while (n--)
- {
- *out++ = (!do_it--);
- }
- x->do_it = do_it;
-
- return (w+4);
-}
-
-static void dirac_dsp(t_dirac *x, t_signal **sp)
-{
- dsp_add(dirac_perform, 3, x, sp[0]->s_vec, sp[0]->s_n);
-}
-
-static void dirac_helper(void)
-{
- post("%c dirac~-object :: generates a dirac (unity-pulse)", HEARTSYMBOL);
- post("creation : \"dirac~ [<position>]\" : create a dirac at specified position (in samples)\n"
- "inlet\t: <position>\t: create a dirac at new position\n"
- "\t 'bang'\t: create a dirac at specified position\n"
- "\t 'help'\t: view this\n"
- "outlet\t: signal~");
-}
-
-
-
-static void *dirac_new(t_floatarg where)
-{
- t_dirac *x = (t_dirac *)pd_new(dirac_class);
-
- outlet_new(&x->x_obj, gensym("signal"));
-
- x->do_it = 0;
- x->position = where;
- return (x);
-}
-
-void dirac_setup(void)
-{
- dirac_class = class_new(gensym("dirac~"), (t_newmethod)dirac_new, 0,
- sizeof(t_dirac), 0, A_DEFFLOAT, 0);
- class_addfloat(dirac_class, dirac_float);
- class_addbang(dirac_class, dirac_bang);
- class_addmethod(dirac_class, (t_method)dirac_dsp, gensym("dsp"), 0);
-
- class_addmethod(dirac_class, (t_method)dirac_helper, gensym("help"), 0);
- class_sethelpsymbol(dirac_class, gensym("zexy/dirac~"));
-}
-
-
/* ------------------------ step~ ----------------------------- */
-
static t_class *step_class;
typedef struct _step
@@ -198,7 +124,7 @@ static void *step_new(t_floatarg farg)
return (x);
}
-void step_setup(void)
+void step_tilde_setup(void)
{
step_class = class_new(gensym("step~"), (t_newmethod)step_new, 0,
sizeof(t_step), 0, A_DEFFLOAT, 0);
@@ -211,12 +137,5 @@ void step_setup(void)
class_addmethod(step_class, (t_method)step_helper, gensym("help"), 0);
class_sethelpsymbol(step_class, gensym("zexy/step~"));
-}
-
-/* global setup routine */
-
-void z_testfun_setup(void)
-{
- step_setup();
- dirac_setup();
+ zexy_register("step~");
}
diff --git a/src/strcmp.c b/src/strcmp.c
new file mode 100644
index 0000000..4bfeb8b
--- /dev/null
+++ b/src/strcmp.c
@@ -0,0 +1,103 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
+#include "zexy.h"
+#include <stdlib.h>
+#include <string.h>
+
+/*
+ * strcmp : compare 2 lists as if they were strings
+*/
+
+/* ------------------------- strcmp ------------------------------- */
+
+/* compare 2 lists ( == for lists) */
+
+static t_class *strcmp_class;
+
+typedef struct _strcmp
+{
+ t_object x_obj;
+
+ t_binbuf *bbuf1, *bbuf2;
+} t_strcmp;
+
+static void strcmp_bang(t_strcmp *x)
+{
+ char *str1=0, *str2=0;
+ int n1=0, n2=0;
+ int result = 0;
+
+ binbuf_gettext(x->bbuf1, &str1, &n1);
+ binbuf_gettext(x->bbuf2, &str2, &n2);
+
+ result = strcmp(str1, str2);
+
+ freebytes(str1, n1);
+ freebytes(str2, n2);
+
+ outlet_float(x->x_obj.ob_outlet, result);
+}
+
+static void strcmp_secondlist(t_strcmp *x, t_symbol *s, int argc, t_atom *argv)
+{
+ binbuf_clear(x->bbuf2);
+ binbuf_add(x->bbuf2, argc, argv);
+}
+
+static void strcmp_list(t_strcmp *x, t_symbol *s, int argc, t_atom *argv)
+{
+ binbuf_clear(x->bbuf1);
+ binbuf_add(x->bbuf1, argc, argv);
+
+ strcmp_bang(x);
+}
+
+static void *strcmp_new(t_symbol *s, int argc, t_atom *argv)
+{
+ t_strcmp *x = (t_strcmp *)pd_new(strcmp_class);
+
+ outlet_new(&x->x_obj, 0);
+ inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("list"), gensym("lst2"));
+
+ x->bbuf1 = binbuf_new();
+ x->bbuf2 = binbuf_new();
+
+
+ strcmp_secondlist(x, gensym("list"), argc, argv);
+
+ return (x);
+}
+
+static void strcmp_free(t_strcmp *x)
+{
+ binbuf_free(x->bbuf1);
+ binbuf_free(x->bbuf2);
+}
+
+
+void strcmp_setup(void)
+{
+ strcmp_class = class_new(gensym("strcmp"), (t_newmethod)strcmp_new,
+ (t_method)strcmp_free, sizeof(t_strcmp), 0, A_GIMME, 0);
+
+ class_addbang (strcmp_class, strcmp_bang);
+ class_addlist (strcmp_class, strcmp_list);
+ class_addmethod (strcmp_class, (t_method)strcmp_secondlist, gensym("lst2"), A_GIMME, 0);
+
+ class_sethelpsymbol(strcmp_class, gensym("zexy/strcmp"));
+ zexy_register("strcmp");
+}
diff --git a/src/sum.c b/src/sum.c
new file mode 100644
index 0000000..67019ee
--- /dev/null
+++ b/src/sum.c
@@ -0,0 +1,61 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
+#include "zexy.h"
+
+/* sum :: the sum of a list of floats */
+
+static t_class *sum_class;
+
+typedef struct _sum
+{
+ t_object x_obj;
+} t_sum;
+
+static void sum_list(t_sum *x, t_symbol *s, int argc, t_atom *argv)
+{
+ t_float sum = 0.f;
+
+ while(argc--)sum+=atom_getfloat(argv++);
+
+ outlet_float(x->x_obj.ob_outlet,sum);
+}
+
+static void *sum_new(void)
+{
+ t_sum *x = (t_sum *)pd_new(sum_class);
+
+ outlet_new(&x->x_obj, gensym("float"));
+
+ return (x);
+}
+
+static void sum_help(void)
+{
+ post("sum\t:: calculate the sum of a list of floats");
+}
+
+void sum_setup(void)
+{
+ sum_class = class_new(gensym("sum"), (t_newmethod)sum_new, 0,
+ sizeof(t_sum), 0, A_DEFFLOAT, 0);
+
+ class_addlist(sum_class, (t_method)sum_list);
+ class_addmethod(sum_class, (t_method)sum_help, gensym("help"), 0);
+
+ class_sethelpsymbol(sum_class, gensym("zexy/sum"));
+ zexy_register("sum");
+}
diff --git a/src/swap_tilde.c b/src/swap_tilde.c
new file mode 100644
index 0000000..668d8c2
--- /dev/null
+++ b/src/swap_tilde.c
@@ -0,0 +1,101 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ ******************************************************/
+
+/*
+ the long waited for swap~-object that does a byte swap
+ of course, we unfortunately have to quantize the float-signal to 16bit (to get bytes)
+
+ 1110:forum::für::umläute:1999
+*/
+
+#include "zexy.h"
+
+/* ------------------------ swap~ ----------------------------- */
+#define FLOAT2SHORT 32768.
+#define SHORT2FLOAT 1./32768.
+
+static t_class *swap_class;
+
+typedef struct _swap
+{
+ t_object x_obj;
+ int swapper;
+} t_swap;
+
+static void swap_float(t_swap *x, t_floatarg f)
+{
+ x->swapper = (f != 0);
+}
+
+static void swap_bang(t_swap *x)
+{
+ x->swapper ^= 1;
+}
+
+static t_int *swap_perform(t_int *w)
+{
+ t_swap *x = (t_swap *)(w[1]);
+ t_float *in = (t_float *)(w[2]);
+ t_float *out = (t_float *)(w[3]);
+ int n = (int)(w[4]);
+
+
+ if (x->swapper)
+ while (n--) {
+ short dummy = FLOAT2SHORT * *in++;
+ *out++ = SHORT2FLOAT * (short)( ((dummy & 0xFF) << 8) | ((dummy & 0xFF00) >> 8) );
+ }
+ else while (n--) *out++ = *in++;
+
+ return (w+5);
+}
+
+static void swap_dsp(t_swap *x, t_signal **sp)
+{
+ dsp_add(swap_perform, 4, x, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n);
+}
+
+static void swap_helper(void)
+{
+ post("\n%c swap~-object for byteswapping a signal", HEARTSYMBOL);
+ post("<1/0> : turn the swapper on/off\n"
+ "'bang' : toggle the swapper on/off\n"
+ "'help' : view this\n"
+ "signal~");
+ post("outlet : signal~");
+}
+
+static void *swap_new()
+{
+ t_swap *x = (t_swap *)pd_new(swap_class);
+ outlet_new(&x->x_obj, gensym("signal"));
+ x->swapper = 1;
+ return (x);
+}
+
+void swap_tilde_setup(void)
+{
+ swap_class = class_new(gensym("swap~"), (t_newmethod)swap_new, 0,
+ sizeof(t_swap), 0, A_DEFFLOAT, 0);
+ class_addmethod(swap_class, nullfn, gensym("signal"), 0);
+ class_addmethod(swap_class, (t_method)swap_dsp, gensym("dsp"), 0);
+
+ class_addfloat(swap_class, swap_float);
+ class_addbang(swap_class, swap_bang);
+
+ class_addmethod(swap_class, (t_method)swap_helper, gensym("help"), 0);
+ class_sethelpsymbol(swap_class, gensym("zexy/swap~"));
+ zexy_register("swap~");
+}
diff --git a/src/symbol2list.c b/src/symbol2list.c
new file mode 100644
index 0000000..7a29e2a
--- /dev/null
+++ b/src/symbol2list.c
@@ -0,0 +1,163 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
+#include "zexy.h"
+#include <stdlib.h>
+#include <string.h>
+
+#ifndef NT
+# define STATIC_INLINE static
+#endif
+
+/*
+ * symbol2list: convert a symbol into a list (with given delimiters)
+*/
+
+/* ------------------------- symbol2list ------------------------------- */
+
+static t_class *symbol2list_class;
+
+typedef struct _symbol2list
+{
+ t_object x_obj;
+ t_symbol *s, *delimiter;
+ t_atom *argv;
+ int argc, argnum; /* "argnum" is the number of reserved atoms (might be >argc) */
+} t_symbol2list;
+
+static void symbol2list_delimiter(t_symbol2list *x, t_symbol *s){
+ x->delimiter = s;
+}
+
+STATIC_INLINE void string2atom(t_atom *ap, char* cp, int clen){
+ char *buffer=getbytes(sizeof(char)*(clen+1));
+ char *endptr[1];
+ t_float ftest;
+ strncpy(buffer, cp, clen);
+ buffer[clen]=0;
+ // post("converting buffer '%s' %d", buffer, clen);
+ ftest=strtod(buffer, endptr);
+ if (*endptr == buffer){
+ /* strtof() failed, we have a symbol */
+ SETSYMBOL(ap, gensym(buffer));
+ } else {
+ /* it is a number. */
+ SETFLOAT(ap,ftest);
+ }
+ freebytes(buffer, sizeof(char)*(clen+1));
+}
+static void symbol2list_process(t_symbol2list *x)
+{
+ char *cc;
+ char *deli;
+ int dell;
+ char *cp, *d;
+ int i=1;
+
+ if (x->s==NULL){
+ x->argc=0;
+ return;
+ }
+ cc=x->s->s_name;
+ cp=cc;
+
+ if (x->delimiter==NULL || x->delimiter==&s_){
+ i=strlen(cc);
+ if(x->argnum<i){
+ freebytes(x->argv, x->argnum*sizeof(t_atom));
+ x->argnum=i+10;
+ x->argv=getbytes(x->argnum*sizeof(t_atom));
+ }
+ x->argc=i;
+ while(i--)string2atom(x->argv+i, cc+i, 1);
+ return;
+ }
+
+ deli=x->delimiter->s_name;
+ dell=strlen(deli);
+
+
+ /* get the number of tokens */
+ while((d=strstr(cp, deli))){
+ if (d!=NULL && d!=cp){
+ i++;
+ }
+ cp=d+dell;
+ }
+
+ /* resize the list-buffer if necessary */
+ if(x->argnum<i){
+ freebytes(x->argv, x->argnum*sizeof(t_atom));
+ x->argnum=i+10;
+ x->argv=getbytes(x->argnum*sizeof(t_atom));
+ }
+ x->argc=i;
+ /* parse the tokens into the list-buffer */
+ i=0;
+
+ /* find the first token */
+ cp=cc;
+ while(cp==(d=strstr(cp,deli))){cp+=dell;}
+ while((d=strstr(cp, deli))){
+ if(d!=cp){
+ string2atom(x->argv+i, cp, d-cp);
+ i++;
+ }
+ cp=d+dell;
+ }
+
+ if(cp)string2atom(x->argv+i, cp, strlen(cp));
+}
+static void symbol2list_bang(t_symbol2list *x){
+ symbol2list_process(x);
+ if(x->argc)outlet_list(x->x_obj.ob_outlet, 0, x->argc, x->argv);
+}
+static void symbol2list_symbol(t_symbol2list *x, t_symbol *s){
+ x->s = s;
+ symbol2list_bang(x);
+}
+static void *symbol2list_new(t_symbol *s, int argc, t_atom *argv)
+{
+ t_symbol2list *x = (t_symbol2list *)pd_new(symbol2list_class);
+
+ outlet_new(&x->x_obj, 0);
+ inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("symbol"), gensym(""));
+
+ x->argc=0;
+ x->argnum=16;
+ x->argv=getbytes(x->argnum*sizeof(t_atom));
+ symbol2list_delimiter(x, (argc)?atom_getsymbol(argv):gensym(" "));
+
+ return (x);
+}
+
+static void symbol2list_free(t_symbol2list *x)
+{
+}
+
+void symbol2list_setup(void)
+{
+ symbol2list_class = class_new(gensym("symbol2list"), (t_newmethod)symbol2list_new,
+ (t_method)symbol2list_free, sizeof(t_symbol2list), 0, A_GIMME, 0);
+
+ class_addcreator((t_newmethod)symbol2list_new, gensym("s2l"), A_GIMME, 0);
+ class_addsymbol (symbol2list_class, symbol2list_symbol);
+ class_addbang (symbol2list_class, symbol2list_bang);
+ class_addmethod (symbol2list_class, (t_method)symbol2list_delimiter, gensym(""), A_SYMBOL, 0);
+
+ class_sethelpsymbol(symbol2list_class, gensym("zexy/symbol2list"));
+ zexy_register("symbol2list");
+}
diff --git a/src/tabdump.c b/src/tabdump.c
new file mode 100644
index 0000000..d308454
--- /dev/null
+++ b/src/tabdump.c
@@ -0,0 +1,117 @@
+
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
+
+/* hack : 2108:forum::für::umläute:1999 @ iem */
+
+#include "zexy.h"
+
+
+/* =================== tabdump ====================== */
+
+static t_class *tabdump_class;
+
+typedef struct _tabdump
+{
+ t_object x_obj;
+ t_symbol *x_arrayname;
+ t_int startindex, stopindex;
+} t_tabdump;
+
+static void tabdump_bang(t_tabdump *x)
+{
+ t_garray *A;
+ int npoints;
+ t_float *vec;
+
+ if (!(A = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class)))
+ error("%s: no such array", x->x_arrayname->s_name);
+ else if (!garray_getfloatarray(A, &npoints, &vec))
+ error("%s: bad template for tabdump", x->x_arrayname->s_name);
+ else
+ {
+ int n;
+ t_atom *atombuf;
+
+ int start=x->startindex;
+ int stop =x->stopindex;
+ if(start<0||start>stop)start=0;
+ if(stop<start||stop>npoints)stop=npoints;
+ npoints=stop-start;
+
+ atombuf = (t_atom *)getbytes(sizeof(t_atom)*npoints);
+ for (n = 0; n < npoints; n++) SETFLOAT(&atombuf[n], vec[start+n]);
+ outlet_list(x->x_obj.ob_outlet, &s_list, npoints, atombuf);
+ freebytes(atombuf,sizeof(t_atom)*npoints);
+ }
+}
+
+static void tabdump_list(t_tabdump *x, t_symbol*s,int argc, t_atom*argv)
+{
+ int a,b;
+ switch(argc){
+ case 2:
+ a=atom_getint(argv);
+ b=atom_getint(argv+1);
+ x->startindex=(a<b)?a:b;
+ x->stopindex =(a>b)?a:b;
+ tabdump_bang(x);
+ break;
+ default:
+ error("tabdump: list must be 2 floats (is %d atoms)", argc);
+ }
+}
+
+static void tabdump_set(t_tabdump *x, t_symbol *s)
+{
+ x->x_arrayname = s;
+}
+
+static void *tabdump_new(t_symbol *s)
+{
+ t_tabdump *x = (t_tabdump *)pd_new(tabdump_class);
+ x->x_arrayname = s;
+ x->startindex=0;
+ x->stopindex=-1;
+ outlet_new(&x->x_obj, &s_list);
+
+ return (x);
+}
+
+static void tabdump_helper(void)
+{
+ post("\n%c tabdump - object : dumps a table as a package of floats", HEARTSYMBOL);
+ post("'set <table>'\t: read out another table\n"
+ "'bang'\t\t: dump the table\n"
+ "outlet\t\t: table-data as package of floats");
+ post("creation\t: \"tabdump <table>\"");
+
+}
+
+void tabdump_setup(void)
+{
+ tabdump_class = class_new(gensym("tabdump"), (t_newmethod)tabdump_new,
+ 0, sizeof(t_tabdump), 0, A_DEFSYM, 0);
+ class_addbang(tabdump_class, (t_method)tabdump_bang);
+ class_addlist(tabdump_class, (t_method)tabdump_list);
+
+ class_addmethod(tabdump_class, (t_method)tabdump_set, gensym("set"),
+ A_SYMBOL, 0);
+
+ class_addmethod(tabdump_class, (t_method)tabdump_helper, gensym("help"), 0);
+ class_sethelpsymbol(tabdump_class, gensym("zexy/tabdump"));
+}
diff --git a/src/tabminmax.c b/src/tabminmax.c
new file mode 100644
index 0000000..56307e2
--- /dev/null
+++ b/src/tabminmax.c
@@ -0,0 +1,140 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
+/* hack : 2108:forum::für::umläute:1999 @ iem */
+
+#include "zexy.h"
+
+
+/* =================== tabminmax ====================== */
+
+static t_class *tabminmax_class;
+
+typedef struct _tabminmax
+{
+ t_object x_obj;
+ t_outlet*min_out, *max_out;
+ t_symbol *x_arrayname;
+ t_int startindex, stopindex;
+} t_tabminmax;
+
+static void tabminmax_bang(t_tabminmax *x)
+{
+ t_garray *A;
+ int npoints;
+ t_float *vec;
+
+ if (!(A = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class)))
+ error("%s: no such array", x->x_arrayname->s_name);
+ else if (!garray_getfloatarray(A, &npoints, &vec))
+ error("%s: bad template for tabminmax", x->x_arrayname->s_name);
+ else
+ {
+ int n;
+ t_atom atombuf[2];
+ t_float min, max;
+ int mindex, maxdex;
+
+ int start=x->startindex;
+ int stop =x->stopindex;
+ if(start<0||start>stop)start=0;
+ if(stop<start||stop>npoints)stop=npoints;
+ npoints=stop-start;
+
+ min=vec[start];
+ max=vec[start];
+
+ mindex=start;
+ maxdex=start;
+
+ for (n = 1; n < npoints; n++){
+ t_float val=vec[start+n];
+ if(val<min){
+ mindex=start+n;
+ min=val;
+ }
+ if(val>max){
+ maxdex=start+n;
+ max=val;
+ }
+ }
+
+ SETFLOAT(atombuf, max);
+ SETFLOAT(atombuf+1, maxdex);
+ outlet_list(x->max_out, &s_list, 2, atombuf);
+
+ SETFLOAT(atombuf, min);
+ SETFLOAT(atombuf+1, mindex);
+ outlet_list(x->min_out, &s_list, 2, atombuf);
+ }
+}
+
+static void tabminmax_list(t_tabminmax *x, t_symbol*s,int argc, t_atom*argv)
+{
+ int a,b;
+ switch(argc){
+ case 2:
+ a=atom_getint(argv);
+ b=atom_getint(argv+1);
+ x->startindex=(a<b)?a:b;
+ x->stopindex =(a>b)?a:b;
+ tabminmax_bang(x);
+ break;
+ default:
+ error("tabminmax: list must be 2 floats (is %d atoms)", argc);
+ }
+}
+
+static void tabminmax_set(t_tabminmax *x, t_symbol *s)
+{
+ x->x_arrayname = s;
+}
+
+static void *tabminmax_new(t_symbol *s)
+{
+ t_tabminmax *x = (t_tabminmax *)pd_new(tabminmax_class);
+ x->x_arrayname = s;
+ x->startindex=0;
+ x->stopindex=-1;
+ x->min_out=outlet_new(&x->x_obj, &s_list);
+ x->max_out=outlet_new(&x->x_obj, &s_list);
+
+ return (x);
+}
+
+static void tabminmax_helper(void)
+{
+ post("\n%c tabminmax - object : dumps a table as a package of floats", HEARTSYMBOL);
+ post("'set <table>'\t: read out another table\n"
+ "'bang'\t\t: get min and max of the table\n"
+ "outlet\t\t: table-data as package of floats");
+ post("creation\t: \"tabminmax <table>\"");
+
+}
+
+void tabminmax_setup(void)
+{
+ tabminmax_class = class_new(gensym("tabminmax"), (t_newmethod)tabminmax_new,
+ 0, sizeof(t_tabminmax), 0, A_DEFSYM, 0);
+ class_addbang(tabminmax_class, (t_method)tabminmax_bang);
+ class_addlist(tabminmax_class, (t_method)tabminmax_list);
+
+ class_addmethod(tabminmax_class, (t_method)tabminmax_set, gensym("set"),
+ A_SYMBOL, 0);
+
+ class_addmethod(tabminmax_class, (t_method)tabminmax_helper, gensym("help"), 0);
+ class_sethelpsymbol(tabminmax_class, gensym("zexy/tabminmax"));
+}
diff --git a/src/tabset.c b/src/tabset.c
new file mode 100644
index 0000000..9234935
--- /dev/null
+++ b/src/tabset.c
@@ -0,0 +1,102 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
+/* hack : 2108:forum::für::umläute:1999 @ iem */
+
+#include "zexy.h"
+
+
+/* =================== tabset ====================== */
+
+static t_class *tabset_class;
+
+typedef struct _tabset
+{
+ t_object x_obj;
+ t_symbol *x_arrayname;
+} t_tabset;
+
+static void tabset_float(t_tabset *x, t_floatarg f)
+{
+ t_garray *A;
+ int npoints;
+ t_float *vec;
+
+ if (!(A = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class)))
+ error("%s: no such array", x->x_arrayname->s_name);
+ else if (!garray_getfloatarray(A, &npoints, &vec))
+ error("%s: bad template for tabset", x->x_arrayname->s_name);
+ else {
+ while(npoints--)*vec++=f;
+ garray_redraw(A);
+ }
+}
+
+static void tabset_list(t_tabset *x, t_symbol *s, int argc, t_atom* argv)
+{
+ t_garray *A;
+ int npoints;
+ t_float *vec;
+
+ if (!(A = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class)))
+ error("%s: no such array", x->x_arrayname->s_name);
+ else if (!garray_getfloatarray(A, &npoints, &vec))
+ error("%s: bad template for tabset", x->x_arrayname->s_name);
+ else {
+ if (argc>=npoints)
+ while(npoints--)*vec++=atom_getfloat(argv++);
+ else {
+ npoints-=argc;
+ while (argc--)*vec++=atom_getfloat(argv++);
+ while (npoints--)*vec++=0;
+ }
+ garray_redraw(A);
+ }
+}
+static void tabset_set(t_tabset *x, t_symbol *s)
+{
+ x->x_arrayname = s;
+}
+
+static void *tabset_new(t_symbol *s)
+{
+ t_tabset *x = (t_tabset *)pd_new(tabset_class);
+ x->x_arrayname = s;
+
+ return (x);
+}
+
+static void tabset_helper(void)
+{
+ post("\n%c tabset - object : set a table with a package of floats", HEARTSYMBOL);
+ post("'set <table>'\t: set another table\n"
+ "<list>\t\t: set the table"
+ "<float>\t\t: set the table to constant float\n");
+ post("creation\t: \"tabset <table>\"");
+}
+
+void tabset_setup(void)
+{
+ tabset_class = class_new(gensym("tabset"), (t_newmethod)tabset_new,
+ 0, sizeof(t_tabset), 0, A_DEFSYM, 0);
+ class_addfloat(tabset_class, (t_method)tabset_float);
+ class_addlist (tabset_class, (t_method)tabset_list);
+ class_addmethod(tabset_class, (t_method)tabset_set, gensym("set"),
+ A_SYMBOL, 0);
+
+ class_addmethod(tabset_class, (t_method)tabset_helper, gensym("help"), 0);
+ class_sethelpsymbol(tabset_class, gensym("zexy/tabset"));
+}
diff --git a/src/tavg_tilde.c b/src/tavg_tilde.c
new file mode 100644
index 0000000..cddbd41
--- /dev/null
+++ b/src/tavg_tilde.c
@@ -0,0 +1,99 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
+#include "zexy.h"
+#include <math.h>
+
+#ifdef NT
+#define sqrtf sqrt
+#endif
+
+#ifdef MACOSX
+#define sqrtf sqrt
+#endif
+
+
+
+/* triggered average :: arithmetic mean between last and current BANG */
+
+static t_class *tavg_class;
+
+typedef struct _tavg
+{
+ t_object x_obj;
+ t_float n_inv;
+ t_float buf;
+ int blocks;
+} t_tavgtilde;
+
+
+static void tavg_bang(t_tavgtilde *x)
+{
+ if (x->blocks) {
+ outlet_float(x->x_obj.ob_outlet, x->buf*x->n_inv/x->blocks);
+ x->blocks = 0;
+ x->buf = 0.;
+ }
+}
+
+static t_int *tavg_perform(t_int *w)
+{
+ t_float *in = (t_float *)(w[1]);
+ t_tavgtilde *x = (t_tavgtilde *)w[2];
+ int n = (int)(w[3]);
+
+ t_float buf = x->buf;
+
+ while (n--) buf += *in++;
+
+ x->buf = buf;
+ x->blocks++;
+
+ return (w+4);
+}
+
+static void tavg_dsp(t_tavgtilde *x, t_signal **sp)
+{
+ x->n_inv=1./sp[0]->s_n;
+ dsp_add(tavg_perform, 3, sp[0]->s_vec, x, sp[0]->s_n);
+}
+
+static void *tavg_new(void)
+{
+ t_tavgtilde *x = (t_tavgtilde *)pd_new(tavg_class);
+ outlet_new(&x->x_obj, gensym("float"));
+ return (x);
+}
+
+static void tavg_help(void)
+{
+ post("tavg~\t\t:: outputs the arithmetic mean of a signal when triggered");
+ post("<bang>\t\t: triggers the output");
+}
+
+void tavg_tilde_setup(void)
+{
+ tavg_class = class_new(gensym("tavg~"), (t_newmethod)tavg_new, 0,
+ sizeof(t_tavgtilde), 0, A_DEFFLOAT, 0);
+ class_addmethod(tavg_class, nullfn, gensym("signal"), 0);
+ class_addmethod(tavg_class, (t_method)tavg_dsp, gensym("dsp"), 0);
+
+ class_addbang(tavg_class, tavg_bang);
+
+ class_addmethod(tavg_class, (t_method)tavg_help, gensym("help"), 0);
+ class_sethelpsymbol(tavg_class, gensym("zexy/tavg~"));
+ zexy_register("tavg~");
+}
diff --git a/src/time.c b/src/time.c
new file mode 100644
index 0000000..4f54871
--- /dev/null
+++ b/src/time.c
@@ -0,0 +1,122 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
+/*
+ (c) 1202:forum::für::umläute:2000
+ 1506:forum::für::umläute:2003: use timeb only if needed (like on windoze)
+
+ "time" gets the current time from the system
+ "date" gets the current date from the system
+
+*/
+
+#ifdef NT
+#define USE_TIMEB
+#endif
+
+#ifdef MACOSX
+#include <sys/types.h>
+/* typedef _BSD_TIME_T_ time_t; */
+#endif
+
+
+#include "zexy.h"
+#include <time.h>
+
+#ifdef USE_TIMEB
+#include <sys/timeb.h>
+#else
+#include <sys/time.h>
+#endif
+
+
+/* ----------------------- time --------------------- */
+
+static t_class *time_class;
+
+typedef struct _time
+{
+ t_object x_obj;
+
+ int GMT;
+
+ t_outlet *x_outlet1;
+ t_outlet *x_outlet2;
+ t_outlet *x_outlet3;
+ t_outlet *x_outlet4;
+} t_time;
+
+static void *time_new(t_symbol *s, int argc, t_atom *argv)
+{
+ t_time *x = (t_time *)pd_new(time_class);
+ char buf[5];
+
+ x->GMT=0;
+ if (argc) {
+ atom_string(argv, buf, 5);
+ if (buf[0]=='G' && buf[1]=='M' && buf[2]=='T')
+ x->GMT = 1;
+ }
+
+ x->x_outlet1 = outlet_new(&x->x_obj, &s_float);
+ x->x_outlet2 = outlet_new(&x->x_obj, &s_float);
+ x->x_outlet3 = outlet_new(&x->x_obj, &s_float);
+ x->x_outlet4 = outlet_new(&x->x_obj, &s_float);
+
+ return (x);
+}
+
+static void time_bang(t_time *x)
+{
+ struct tm *resolvetime;
+ float ms = 0.f;
+#ifdef USE_TIMEB
+ struct timeb mytime;
+ ftime(&mytime);
+ resolvetime = (x->GMT)?gmtime(&mytime.time):localtime(&mytime.time);
+ ms=mytime.millitm;
+#else
+ struct timeval tv;
+ gettimeofday(&tv, 0);
+ resolvetime = (x->GMT)?gmtime(&tv.tv_sec):localtime(&tv.tv_sec);
+ ms = tv.tv_usec*0.001;
+#endif
+ // outlet_float(x->x_outlet4, (t_float)(mytime.millitm));
+ outlet_float(x->x_outlet4, (t_float)(ms));
+ outlet_float(x->x_outlet3, (t_float)resolvetime->tm_sec);
+ outlet_float(x->x_outlet2, (t_float)resolvetime->tm_min);
+ outlet_float(x->x_outlet1, (t_float)resolvetime->tm_hour);
+}
+
+static void help_time(t_time *x)
+{
+ post("\n%c time\t\t:: get the current system time", HEARTSYMBOL);
+ post("\noutputs are\t: hour / minute / sec / msec");
+ post("\ncreation\t:: 'time [GMT]': show local time or GMT");
+}
+
+void time_setup(void)
+{
+ time_class = class_new(gensym("time"),
+ (t_newmethod)time_new, 0,
+ sizeof(t_time), 0, A_GIMME, 0);
+
+ class_addbang(time_class, time_bang);
+
+ class_addmethod(time_class, (t_method)help_time, gensym("help"), 0);
+ class_sethelpsymbol(time_class, gensym("zexy/time"));
+ zexy_register("time");
+}
diff --git a/src/z_sigpack.c b/src/unpack_tilde.c
index d614543..f65d745 100644
--- a/src/z_sigpack.c
+++ b/src/unpack_tilde.c
@@ -1,84 +1,29 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
/* 0109:forum::für::umläute:2000
- pack~ :: convert signals to float-packages
unpack~ :: convert float-(package)-inputs to signals
*/
-#include "zexy.h"
-#include <math.h>
-
-#ifdef NT
-#pragma warning( disable : 4244 )
-#pragma warning( disable : 4305 )
-#endif
-
-/* ------------------------ pack~ ----------------------------- */
-/* pack the signal-vector to a float-package :: ~2message */
-
-static t_class *sigpack_class;
-
-typedef struct _sigpack
-{
- t_object x_obj;
-
- int vector_length;
- t_atom *buffer;
-
-} t_sigpack;
-
-static t_int *sigpack_perform(t_int *w)
-{
- t_float *in = (t_float *)(w[1]);
- t_sigpack *x = (t_sigpack *)w[2];
- int n = (int)(w[3]), i = 0;
- t_atom *buf = x->buffer;
-
- while (n--) {
- SETFLOAT(&buf[i], *in++);
- i++;
- }
- outlet_list(x->x_obj.ob_outlet, &s_list, x->vector_length, x->buffer);
-
- return (w+4);
-}
-
-static void sigpack_dsp(t_sigpack *x, t_signal **sp)
-{
- if (x->vector_length != sp[0]->s_n) {
- freebytes(x->buffer, x->vector_length * sizeof(t_atom));
- x->vector_length = sp[0]->s_n;
- x->buffer = (t_atom *)getbytes(x->vector_length * sizeof(t_atom));
- }
- dsp_add(sigpack_perform, 3, sp[0]->s_vec, x, sp[0]->s_n);
-}
-
-static void *sigpack_new(void)
-{
- t_sigpack *x = (t_sigpack *)pd_new(sigpack_class);
- x->vector_length = 0;
- x->buffer = 0;
- outlet_new(&x->x_obj, gensym("list"));
-
- return (x);
-}
-
-static void sigpack_help(void)
-{
- post("pack~\t:: outputs the signal-vectors as float-packages");
-}
-
-void sigpack_setup(void)
-{
- sigpack_class = class_new(gensym("pack~"), (t_newmethod)sigpack_new, 0,
- sizeof(t_sigpack), 0, A_DEFFLOAT, 0);
- class_addmethod(sigpack_class, nullfn, gensym("signal"), 0);
- class_addmethod(sigpack_class, (t_method)sigpack_dsp, gensym("dsp"), 0);
+/* ---------------------------- unpack~ ----------------------------- */
+/* unpack a sequence of float-package to a signal-vector */
- class_addmethod(sigpack_class, (t_method)sigpack_help, gensym("help"), 0);
- class_sethelpsymbol(sigpack_class, gensym("zexy/pack~"));
-}
-/* ---------------------------- unpack~ ----------------------------- */
-/* unpack a sequence of float-package to a signal-vector :: message2~ */
+#include "zexy.h"
+#include <math.h>
static t_class *sigunpack_class;
@@ -174,7 +119,7 @@ static void sigunpack_help(void)
post("unpack~\t:: outputs a sequence of floats as a signal");
}
-void sigunpack_setup(void)
+void unpack_tilde_setup(void)
{
sigunpack_class = class_new(gensym("unpack~"), (t_newmethod)sigunpack_new, 0,
sizeof(t_sigunpack), 0, A_DEFFLOAT, 0);
@@ -185,14 +130,5 @@ void sigunpack_setup(void)
class_addmethod(sigunpack_class, (t_method)sigunpack_help, gensym("help"), 0);
class_sethelpsymbol(sigunpack_class, gensym("zexy/unpack~"));
-}
-
-
-
-/* global setup routine */
-
-void z_sigpack_setup(void)
-{
- sigunpack_setup();
- sigpack_setup();
+ zexy_register("unpack~");
}
diff --git a/src/z_random.c b/src/urn.c
index c428fcf..83f94e9 100644
--- a/src/z_random.c
+++ b/src/urn.c
@@ -1,3 +1,18 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
/* 1008:forum::für::umläute:2001 */
@@ -123,7 +138,7 @@ static void *urn_new(t_symbol *s, int argc, t_atom *argv)
return (x);
}
-static void urn_setup(void)
+void urn_setup(void)
{
urn_class = class_new(gensym("urn"), (t_newmethod)urn_new,
0, sizeof(t_urn), 0, A_GIMME, 0);
@@ -135,9 +150,5 @@ static void urn_setup(void)
class_sethelpsymbol(urn_class, gensym("zexy/urn"));
-}
-
-void z_random_setup(void)
-{
- urn_setup();
+ zexy_register("urn");
}
diff --git a/src/winNT_portio.c b/src/winNT_portio.c
new file mode 100644
index 0000000..d892977
--- /dev/null
+++ b/src/winNT_portio.c
@@ -0,0 +1,107 @@
+/*
+ * this is a wrapper for the cor port i/o functions for WinNT/2000/XP.
+ * this is to be replaced by some functions that are platform/interface
+ * specific to access the data lines.
+ * for now, this is only for parport access, but in future there will be a way
+ * to plug this on the usb bus.
+ * if the interface changes, only this file has to be adopted for the target system
+ */
+#ifdef NT
+
+#include <stdio.h>
+#include <windows.h>
+
+int read_parport(int port);
+void write_parport(int port, int value);
+int open_port(int port);
+
+static BOOL bPrivException = FALSE;
+
+int read_parport(int port)
+{
+ // byte = _inp((unsigned short)port);
+ unsigned char value;
+
+ __asm mov edx,port
+ __asm in al,dx
+ __asm mov value,al
+ return (int)value;
+}
+
+void write_parport(int port, int invalue)
+{
+ // _outp((unsigned short)port, value);
+ BYTE value = (BYTE)invalue;
+ __asm mov edx,port
+ __asm mov al,value
+ __asm out dx,al
+}
+
+static LONG WINAPI HandlerExceptionFilter ( EXCEPTION_POINTERS *pExPtrs )
+{
+
+ if (pExPtrs->ExceptionRecord->ExceptionCode == EXCEPTION_PRIV_INSTRUCTION)
+ {
+ pExPtrs->ContextRecord->Eip ++; // Skip the OUT or IN instruction that caused the exception
+ bPrivException = TRUE;
+ return EXCEPTION_CONTINUE_EXECUTION;
+ }
+ else
+ return EXCEPTION_CONTINUE_SEARCH;
+}
+
+static BOOL StartUpIoPorts(UINT PortToAccess, BOOL bShowMessageBox, HWND hParentWnd)
+{
+ HANDLE hUserPort;
+
+ hUserPort = CreateFile("\\\\.\\UserPort", GENERIC_READ, 0, NULL,OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ CloseHandle(hUserPort); // Activate the driver
+ Sleep(100); // We must make a process switch
+
+ SetUnhandledExceptionFilter(HandlerExceptionFilter);
+
+ bPrivException = FALSE;
+ read_parport(PortToAccess); // Try to access the given port address
+
+ if (bPrivException)
+ {
+ if (bShowMessageBox)
+ {
+#if 0
+ MessageBox(hParentWnd,"Privileged instruction exception has occured!\r\n\r\n"
+ "To use this external under Windows NT, 2000 or XP\r\n"
+ "you need to install the driver 'UserPort.sys' and grant\r\n"
+ "access to the ports used by this program.\r\n\r\n"
+ "See the file README for further information!\r\n", NULL, MB_OK);
+#endif
+ }
+ return FALSE;
+ }
+ return TRUE;
+}
+ /* check if we are running NT/2k/XP */
+static int IsWinNT(void)
+{
+ OSVERSIONINFO OSVersionInfo;
+ OSVersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+
+ GetVersionEx(&OSVersionInfo);
+
+ return OSVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT;
+}
+
+ /* open parport */
+int open_port(int port)
+{
+ if(IsWinNT()) /* we are under NT and need kernel driver */
+ {
+ if(StartUpIoPorts(port, 1, 0))
+ return(0);
+ return(-1);
+ }
+ else /* no need to use kernel driver */
+ {
+ return(0);
+ }
+}
+#endif /* NT */
diff --git a/src/z_wrap.c b/src/wrap.c
index 80b0fcd..9707f3f 100644
--- a/src/z_wrap.c
+++ b/src/wrap.c
@@ -1,3 +1,19 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
/* wrap floats between to limits */
#include "zexy.h"
@@ -52,7 +68,7 @@ void *wrap_new(t_symbol *s, int argc, t_atom*argv)
return (void *)x;
}
-void z_wrap_setup(void) {
+void wrap_setup(void) {
wrap_class = class_new(gensym("wrap"),
(t_newmethod)wrap_new,
0, sizeof(t_wrap),
@@ -61,4 +77,5 @@ void z_wrap_setup(void) {
class_addfloat (wrap_class, wrap_float);
class_addmethod(wrap_class, (t_method)wrap_set, gensym("set"), A_GIMME, 0);
class_sethelpsymbol(wrap_class, gensym("zexy/wrap"));
+ zexy_register("wrap");
}
diff --git a/src/z_connective.c b/src/z_connective.c
deleted file mode 100644
index d54f476..0000000
--- a/src/z_connective.c
+++ /dev/null
@@ -1,621 +0,0 @@
-/* 2305:forum::für::umläute:2001 */
-
-/* connective objects */
-
-/*
- segregate : segregate atoms by their types
- nop : a do-nothing, pass-everything
- lister : the same as "float" for floats but for packages
- a2l : convert "anything" to "list"
- list2int : cast all floats of a list to integers
- glue : glue 2 lists together (append,...)
- . : scalar mult
- repeat : repeat a message a given number times
- TODO : any
-*/
-
-#include "zexy.h"
-#include <string.h>
-
-/* -------------------- segregate ------------------------------ */
-
-/*
- sorts the input by type ::
- known types are (in order of their outlets ::
- BANG, FLOAT, SYMBOL, LIST, POINTER, ANYTHING
-*/
-
-static t_class *segregate_class;
-
-typedef struct _segregate
-{
- t_object x_obj;
-
- t_outlet *bang_out, *float_out, *symbol_out, *list_out, *pointer_out, *any_out;
-} t_segregate;
-
-static void segregate_bang(t_segregate *x)
-{ outlet_bang(x->bang_out); }
-
-static void segregate_float(t_segregate *x, t_float f)
-{ outlet_float(x->float_out, f); }
-
-static void segregate_symbol(t_segregate *x, t_symbol *s)
-{ outlet_symbol(x->symbol_out, s); }
-
-static void segregate_pointer(t_segregate *x, t_gpointer *gp)
-{ outlet_pointer(x->pointer_out, gp); }
-
-static void segregate_list(t_segregate *x, t_symbol *s, int argc, t_atom *argv)
-{ outlet_list(x->list_out, s, argc, argv); }
-
-static void segregate_anything(t_segregate *x, t_symbol *s, int argc, t_atom *argv)
-{ outlet_anything(x->any_out, s, argc, argv); }
-
-static void *segregate_new(t_symbol *s)
-{
- t_segregate *x = (t_segregate *)pd_new(segregate_class);
-
- x->bang_out = outlet_new(&x->x_obj, &s_bang);
- x->float_out = outlet_new(&x->x_obj, &s_float);
- x->symbol_out = outlet_new(&x->x_obj, &s_symbol);
- x->list_out = outlet_new(&x->x_obj, &s_list);
- x->pointer_out = outlet_new(&x->x_obj, &s_pointer);
- x->any_out = outlet_new(&x->x_obj, 0);
-
- return (x);
-}
-
-static void segregate_setup(void)
-{
- segregate_class = class_new(gensym("segregate"), (t_newmethod)segregate_new,
- 0, sizeof(t_segregate), 0, 0);
-
- class_addbang(segregate_class, segregate_bang);
- class_addfloat(segregate_class, (t_method)segregate_float);
- class_addsymbol(segregate_class, segregate_symbol);
- class_addpointer(segregate_class, segregate_pointer);
- class_addlist(segregate_class, segregate_list);
- class_addanything(segregate_class, segregate_anything);
-
- class_sethelpsymbol(segregate_class, gensym("zexy/segregate"));
-}
-
-/* ------------------------- nop ------------------------------- */
-
-/* a no-operation - just pass through what you get in */
-
-static t_class *nop_class;
-
-typedef struct _nop
-{
- t_object x_obj;
-} t_nop;
-
-static void nop_anything(t_nop *x, t_symbol *s, int argc, t_atom *argv)
-{ outlet_anything(x->x_obj.ob_outlet, s, argc, argv);}
-
-static void nop_list(t_nop *x, t_symbol *s, int argc, t_atom *argv)
-{ outlet_list(x->x_obj.ob_outlet, s, argc, argv);}
-
-static void nop_float(t_nop *x, t_floatarg f)
-{ outlet_float(x->x_obj.ob_outlet, f);}
-
-static void nop_symbol(t_nop *x, t_symbol *s)
-{ outlet_symbol(x->x_obj.ob_outlet, s);}
-
-static void nop_pointer(t_nop *x, t_gpointer *gp)
-{ outlet_pointer(x->x_obj.ob_outlet, gp);}
-
-static void nop_bang(t_nop *x)
-{ outlet_bang(x->x_obj.ob_outlet);}
-
-static void *nop_new(void)
-{
- t_nop *x = (t_nop *)pd_new(nop_class);
- outlet_new(&x->x_obj, 0);
- return (x);
-}
-
-static void nop_setup(void)
-{
- nop_class = class_new(gensym("nop"), (t_newmethod)nop_new,
- 0, sizeof(t_nop), 0, 0);
-
- class_addbang (nop_class, nop_bang);
- class_addfloat (nop_class, nop_float);
- class_addsymbol (nop_class, nop_symbol);
- class_addpointer (nop_class, nop_pointer);
- class_addlist (nop_class, nop_list);
- class_addanything(nop_class, nop_anything);
-
- class_sethelpsymbol(nop_class, gensym("zexy/nop"));
-}
-
-
-
-
-/* ------------------------- a2l ------------------------------- */
-
-/* convert anythings to lists, pass through the rest */
-
-static t_class *a2l_class;
-
-typedef struct _a2l
-{
- t_object x_obj;
-} t_a2l;
-
-static void a2l_anything(t_a2l *x, t_symbol *s, int argc, t_atom *argv)
-{
- int n = argc+1;
- t_atom *cur, *alist = (t_atom *)getbytes(n * sizeof(t_atom));
-
- cur = alist;
- SETSYMBOL(cur, s);
- cur++;
-
- memcpy(cur, argv, argc * sizeof(t_atom));
-
- outlet_list(x->x_obj.ob_outlet, gensym("list"), n, alist);
-
- freebytes(alist, n * sizeof(t_atom));
-
-}
-
-static void a2l_list(t_a2l *x, t_symbol *s, int argc, t_atom *argv)
-{ outlet_list(x->x_obj.ob_outlet, s, argc, argv);}
-
-static void a2l_float(t_a2l *x, t_floatarg f)
-{ outlet_float(x->x_obj.ob_outlet, f);}
-
-static void a2l_symbol(t_a2l *x, t_symbol *s)
-{ outlet_symbol(x->x_obj.ob_outlet, s);}
-
-static void a2l_pointer(t_a2l *x, t_gpointer *gp)
-{ outlet_pointer(x->x_obj.ob_outlet, gp);}
-
-static void a2l_bang(t_a2l *x)
-{ outlet_bang(x->x_obj.ob_outlet);}
-
-static void *a2l_new(void)
-{
- t_a2l *x = (t_a2l *)pd_new(a2l_class);
- outlet_new(&x->x_obj, 0);
- return (x);
-}
-
-static void a2l_setup(void)
-{
-
- a2l_class = class_new(gensym("any2list"), (t_newmethod)a2l_new,
- 0, sizeof(t_a2l), 0, 0);
- class_addcreator((t_newmethod)a2l_new, gensym("a2l"), 0);
-
-
- class_addbang (a2l_class, a2l_bang);
- class_addfloat (a2l_class, a2l_float);
- class_addsymbol (a2l_class, a2l_symbol);
- class_addpointer (a2l_class, a2l_pointer);
- class_addlist (a2l_class, a2l_list);
- class_addanything(a2l_class, a2l_anything);
-
- class_sethelpsymbol(a2l_class, gensym("zexy/any2list"));
-}
-
-/* ------------------------- list ------------------------------- */
-
-/* this is for packages, what "float" is for floats */
-
-static t_class *mypdlist_class;
-
-typedef struct _mypdlist
-{
- t_object x_obj;
-
- int x_n;
- t_atom *x_list;
-} t_mypdlist;
-
-static void mypdlist_secondlist(t_mypdlist *x, t_symbol *s, int argc, t_atom *argv)
-{
- if (argc) {
- if (x->x_n != argc) {
- freebytes(x->x_list, x->x_n * sizeof(t_atom));
- x->x_n = argc;
- x->x_list = copybytes(argv, argc * sizeof(t_atom));
- } else memcpy(x->x_list, argv, argc * sizeof(t_atom));
- }
-}
-
-static void mypdlist_list(t_mypdlist *x, t_symbol *s, int argc, t_atom *argv)
-{
- if (x->x_n != argc) {
- freebytes(x->x_list, x->x_n * sizeof(t_atom));
- x->x_n = argc;
- x->x_list = copybytes(argv, argc * sizeof(t_atom));
- } else memcpy(x->x_list, argv, argc * sizeof(t_atom));
-
- outlet_list(x->x_obj.ob_outlet, gensym("list"), x->x_n, x->x_list);
-}
-static void mypdlist_bang(t_mypdlist *x)
-{ outlet_list(x->x_obj.ob_outlet, gensym("list"), x->x_n, x->x_list);}
-
-static void mypdlist_free(t_mypdlist *x)
-{ freebytes(x->x_list, x->x_n * sizeof(t_atom)); }
-
-static void *mypdlist_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_mypdlist *x = (t_mypdlist *)pd_new(mypdlist_class);
-
- outlet_new(&x->x_obj, 0);
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("list"), gensym("lst2"));
-
- x->x_n = 0;
- x->x_list = 0;
-
- mypdlist_secondlist(x, gensym("list"), argc, argv);
-
- return (x);
-}
-
-static void mypdlist_setup(void)
-{
- mypdlist_class = class_new(gensym("lister"), (t_newmethod)mypdlist_new,
- (t_method)mypdlist_free, sizeof(t_mypdlist), 0, A_GIMME, 0);
- /* i don't know how to get this work with name=="list" !!! */
-
- class_addcreator((t_newmethod)mypdlist_new, gensym("l"), A_GIMME, 0);
-
- class_addbang (mypdlist_class, mypdlist_bang);
- class_addlist (mypdlist_class, mypdlist_list);
- class_addmethod (mypdlist_class, (t_method)mypdlist_secondlist, gensym("lst2"), A_GIMME, 0);
-
- class_sethelpsymbol(mypdlist_class, gensym("zexy/lister"));
-}
-
-/* ------------------------- list2int ------------------------------- */
-
-/* cast each float of a list (or anything) to integer */
-
-static t_class *list2int_class;
-
-static void list2int_any(t_mypdlist *x, t_symbol *s, int argc, t_atom *argv)
-{
- t_atom *ap;
- if (x->x_n != argc) {
- freebytes(x->x_list, x->x_n * sizeof(t_atom));
- x->x_n = argc;
- x->x_list = copybytes(argv, argc * sizeof(t_atom));
- } else memcpy(x->x_list, argv, argc * sizeof(t_atom));
- ap = x->x_list;
- while(argc--){
- if(ap->a_type == A_FLOAT)ap->a_w.w_float=(int)ap->a_w.w_float;
- ap++;
- }
- outlet_anything(x->x_obj.ob_outlet, s, x->x_n, x->x_list);
-}
-static void list2int_bang(t_mypdlist *x)
-{ outlet_bang(x->x_obj.ob_outlet);}
-static void list2int_float(t_mypdlist *x, t_float f)
-{ outlet_float(x->x_obj.ob_outlet, (int)f);}
-static void list2int_symbol(t_mypdlist *x, t_symbol *s)
-{ outlet_symbol(x->x_obj.ob_outlet, s);}
-static void list2int_pointer(t_mypdlist *x, t_gpointer *p)
-{ outlet_pointer(x->x_obj.ob_outlet, p);}
-
-static void *list2int_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_mypdlist *x = (t_mypdlist *)pd_new(list2int_class);
- outlet_new(&x->x_obj, 0);
- x->x_n = 0;
- x->x_list = 0;
- return (x);
-}
-
-static void list2int_setup(void)
-{
- list2int_class = class_new(gensym("list2int"), (t_newmethod)list2int_new,
- (t_method)mypdlist_free, sizeof(t_mypdlist), 0, A_GIMME, 0);
- class_addcreator((t_newmethod)list2int_new, gensym("l2i"), A_GIMME, 0);
- class_addanything(list2int_class, list2int_any);
- class_addlist(list2int_class, list2int_any);
- class_addbang(list2int_class, list2int_bang);
- class_addfloat(list2int_class, list2int_float);
- class_addsymbol(list2int_class, list2int_symbol);
- class_addpointer(list2int_class, list2int_pointer);
- class_sethelpsymbol(list2int_class, gensym("zexy/list2int"));
-}
-
-/* ------------------------- glue ------------------------------- */
-
-/* glue 2 lists together (append) */
-
-static t_class *glue_class;
-
-typedef struct _glue
-{
- t_object x_obj;
-
- t_atom *ap2, *ap;
- t_int n1, n2, n;
-
- t_int changed;
-} t_glue;
-
-static void glue_lst2(t_glue *x, t_symbol *s, int argc, t_atom *argv)
-{
- x->changed = 1;
- if (x->n2 != argc) {
- freebytes(x->ap2, x->n2 * sizeof(t_atom));
- x->n2 = argc;
- x->ap2 = copybytes(argv, argc * sizeof(t_atom));
- } else memcpy(x->ap2, argv, argc * sizeof(t_atom));
-}
-
-static void glue_lst(t_glue *x, t_symbol *s, int argc, t_atom *argv)
-{
- if (x->n != x->n2+argc) {
- freebytes(x->ap, x->n * sizeof(t_atom));
- x->n1 = argc;
- x->n = x->n1+x->n2;
- x->ap = (t_atom *)getbytes(sizeof(t_atom)*x->n);
- memcpy(x->ap+argc, x->ap2, x->n2*sizeof(t_atom));
- } else if ((x->n1 != argc)||x->changed)memcpy(x->ap+argc, x->ap2, x->n2*sizeof(t_atom));
-
- x->n1 = argc;
- memcpy(x->ap, argv, x->n1*sizeof(t_atom));
-
- x->changed=0;
-
- outlet_list(x->x_obj.ob_outlet, gensym("list"), x->n, x->ap);
-}
-
-static void glue_bang(t_glue *x)
-{
- if (x->changed) {
- if (x->n1+x->n2 != x->n){
- t_atom *ap = (t_atom*)getbytes(sizeof(t_atom)*(x->n1+x->n2));
- memcpy(ap, x->ap, x->n1*sizeof(t_atom));
- freebytes(x->ap, sizeof(t_atom)*x->n);
- x->ap=ap;
- x->n=x->n1+x->n2;
- }
- memcpy(x->ap+x->n1, x->ap2, x->n2*sizeof(t_atom));
- x->changed=0;
- }
-
- outlet_list(x->x_obj.ob_outlet, gensym("list"), x->n, x->ap);
-}
-
-static void glue_free(t_glue *x)
-{
- freebytes(x->ap, sizeof(t_atom)*x->n);
- freebytes(x->ap2, sizeof(t_atom)*x->n2);
-}
-
-static void *glue_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_glue *x = (t_glue *)pd_new(glue_class);
-
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("list"), gensym(""));
- outlet_new(&x->x_obj, 0);
- x->n =x->n2 = 0;
- x->ap=x->ap2 = 0;
- x->changed = 0;
-
- if (argc)glue_lst2(x, gensym("list"), argc, argv);
-
- return (x);
-}
-
-static void glue_setup(void)
-{
- glue_class = class_new(gensym("glue"), (t_newmethod)glue_new,
- (t_method)glue_free, sizeof(t_glue), 0, A_GIMME, 0);
- class_addlist(glue_class, glue_lst);
- class_addmethod (glue_class, (t_method)glue_lst2, gensym(""), A_GIMME, 0);
- class_addbang(glue_class, glue_bang);
-
- class_sethelpsymbol(glue_class, gensym("zexy/glue"));
-}
-
-/*skalar multiplikation */
-
-static t_class *scalmul_class;
-static t_class *scalmul_scal_class;
-
-typedef struct _scalmul
-{
- t_object x_obj;
-
- t_int n1, n2;
-
- t_float *buf1, *buf2;
-
- t_float f;
-} t_scalmul;
-
-
-static void scalmul_lst2(t_scalmul *x, t_symbol *s, int argc, t_atom *argv)
-{
- t_float *fp;
- if (x->n2 != argc) {
- freebytes(x->buf2, x->n2 * sizeof(t_float));
- x->n2 = argc;
- x->buf2=(t_float *)getbytes(sizeof(t_float)*x->n2);
- };
- fp = x->buf2;
- while(argc--)*fp++=atom_getfloat(argv++);
-}
-
-static void scalmul_lst(t_scalmul *x, t_symbol *s, int argc, t_atom *argv)
-{
- t_float *fp;
- t_atom *ap;
- int n;
-
- if (argc){
- if (x->n1 != argc) {
- freebytes(x->buf1, x->n1 * sizeof(t_float));
- x->n1 = argc;
- x->buf1=(t_float *)getbytes(sizeof(t_float)*x->n1);
- };
- fp = x->buf1;
- while(argc--)*fp++=atom_getfloat(argv++);
- }
-
- if (x->n1*x->n2==1){
- outlet_float(x->x_obj.ob_outlet, *x->buf1**x->buf2);
- return;
- }
- if (x->n1==1){
- t_atom *a;
- int i = x->n2;
- t_float f = *x->buf1;
- fp = x->buf2;
- n = x->n2;
- ap = (t_atom *)getbytes(sizeof(t_atom)*n);
- a = ap;
- while(i--){
- SETFLOAT(a, *fp++*f);
- a++;
- }
- } else if (x->n2==1){
- t_float f = *x->buf2;
- t_atom *a;
- int i = x->n1;
- n = x->n1;
- ap = (t_atom *)getbytes(sizeof(t_atom)*n);
- a = ap;
- fp = x->buf1;
- while(i--){
- SETFLOAT(a, *fp++*f);
- a++;
- }
- } else {
- t_atom *a;
- int i;
- t_float *fp2=x->buf2;
- fp = x->buf1;
- n = x->n1;
- if (x->n1!=x->n2){
- post("scalar multiplication: truncating vectors to the same length");
- if (x->n2<x->n1)n=x->n2;
- }
- ap = (t_atom *)getbytes(sizeof(t_atom)*n);
- a = ap;
- i=n;
- while(i--){
- SETFLOAT(a, *fp++**fp2++);
- a++;
- }
- }
- outlet_list(x->x_obj.ob_outlet, gensym("list"), n, ap);
- freebytes(ap, sizeof(t_atom)*n);
-}
-static void scalmul_free(t_scalmul *x)
-{
- freebytes(x->buf1, sizeof(t_float)*x->n1);
- freebytes(x->buf2, sizeof(t_float)*x->n2);
-}
-
-static void *scalmul_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_scalmul *x;
-
- if (argc-1){
- x = (t_scalmul *)pd_new(scalmul_class);
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("list"), gensym(""));
- } else x = (t_scalmul *)pd_new(scalmul_scal_class);
-
- outlet_new(&x->x_obj, 0);
-
- x->n1 =1;
- x->buf1 =(t_float*)getbytes(sizeof(t_float));
- *x->buf1=0;
-
- if (argc)scalmul_lst2(x, gensym("list"), argc, argv);
- else {
- x->n2 =1;
- x->buf2 =(t_float*)getbytes(sizeof(t_float));
- *x->buf2=0;
- }
-
- if (argc==1)floatinlet_new(&x->x_obj, x->buf2);
-
- return (x);
-}
-
-static void scalmul_setup(void)
-{
- scalmul_class = class_new(gensym("."), (t_newmethod)scalmul_new,
- (t_method)scalmul_free, sizeof(t_scalmul), 0, A_GIMME, 0);
- class_addlist(scalmul_class, scalmul_lst);
- class_addmethod (scalmul_class, (t_method)scalmul_lst2, gensym(""), A_GIMME, 0);
- scalmul_scal_class = class_new(gensym("."), 0, (t_method)scalmul_free,
- sizeof(t_scalmul), 0, 0);
- class_addlist(scalmul_scal_class, scalmul_lst);
-
- class_sethelpsymbol(scalmul_class, gensym("zexy/scalarmult"));
- class_sethelpsymbol(scalmul_scal_class, gensym("zexy/scalarmult"));
-}
-
-
-/* ------------------------- repeat ------------------------------- */
-
-/* a no-operation - just pass through what you get in */
-
-static t_class *repeat_class;
-
-typedef struct _repeat
-{
- t_object x_obj;
- t_float fcount;
-} t_repeat;
-
-static void repeat_anything(t_repeat *x, t_symbol *s, int argc, t_atom *argv)
-{
- int i;
- i=x->fcount;
- if (i<0)i=1;
- while(i--)outlet_anything(x->x_obj.ob_outlet, s, argc, argv);
-}
-
-static void *repeat_new(t_float f)
-{
- t_repeat *x = (t_repeat *)pd_new(repeat_class);
- x->fcount = f;
- floatinlet_new(&x->x_obj, &x->fcount);
- outlet_new(&x->x_obj, 0);
- return (x);
-}
-
-static void repeat_setup(void)
-{
- repeat_class = class_new(gensym("repeat"), (t_newmethod)repeat_new,
- 0, sizeof(t_repeat), 0, A_FLOAT, 0);
- class_addanything(repeat_class, repeat_anything);
-
- class_sethelpsymbol(repeat_class, gensym("zexy/repeat"));
-}
-
-
-
-/* -------------- overall setup routine for this file ----------------- */
-
-void z_connective_setup(void)
-{
- segregate_setup();
- nop_setup();
- mypdlist_setup();
- glue_setup();
-
- list2int_setup();
- scalmul_setup();
-
- a2l_setup();
- repeat_setup();
-
- /* I don't supply HELP - functionality, since this might harm overall-performance here */
-}
diff --git a/src/z_coordinates.c b/src/z_coordinates.c
deleted file mode 100644
index 59bd6aa..0000000
--- a/src/z_coordinates.c
+++ /dev/null
@@ -1,440 +0,0 @@
-#include "zexy.h"
-#include <math.h>
-
-#ifdef NT
-#pragma warning( disable : 4244 )
-#pragma warning( disable : 4305 )
-#define atan2f atan2
-#define sqrtf sqrt
-#define sinf sin
-#define cosf cos
-#endif
-
-#ifdef MACOSX
-#define atan2f atan2
-#define sqrtf sqrt
-#define sinf sin
-#define cosf cos
-#endif
-
-/* ----------------------- deg/rad utils ----------------- */
-t_class *deg2rad_class, *rad2deg_class;
-typedef struct _deg2rad
-{
- t_object x_obj;
- t_float factor;
-} t_deg2rad;
-
-/* deg2rad :: degree 2 radian */
-
-static void deg2rad_float(t_deg2rad *x, t_float f)
-{
- outlet_float(x->x_obj.ob_outlet, x->factor*f);
-}
-
-static void *deg2rad_new(t_floatarg f)
-{
- t_deg2rad *x = (t_deg2rad *)pd_new(deg2rad_class);
- outlet_new(&x->x_obj, gensym("float"));
- x->factor=atan2f(1,1)/45.0;
-
- return (x);
-}
-
-static void deg2rad_help(void)
-{
- post("deg2rad\t:: convert degree 2 radians");
-}
-
-static void deg2rad_setup(void)
-{
- deg2rad_class = class_new(gensym("deg2rad"), (t_newmethod)deg2rad_new, 0,
- sizeof(t_deg2rad), 0, A_DEFFLOAT, 0);
-
- class_addmethod(deg2rad_class, (t_method)deg2rad_help, gensym("help"), 0);
- class_addfloat(deg2rad_class, deg2rad_float);
- class_sethelpsymbol(deg2rad_class, gensym("zexy/deg2rad"));
-}
-
-/* rad2deg :: radian 2 degree */
-t_class *rad2deg_class;
-
-static void rad2deg_float(t_deg2rad *x, t_float f)
-{
- outlet_float(x->x_obj.ob_outlet, x->factor*f);
-}
-
-static void *rad2deg_new(t_floatarg f)
-{
- t_deg2rad *x = (t_deg2rad *)pd_new(rad2deg_class);
- outlet_new(&x->x_obj, gensym("float"));
- x->factor=45.0/atan2f(1,1);
-
- return (x);
-}
-
-static void rad2deg_help(void)
-{
- post("rad2deg\t:: convert radian 2 degree");
-}
-
-static void rad2deg_setup(void)
-{
- rad2deg_class = class_new(gensym("rad2deg"), (t_newmethod)rad2deg_new, 0,
- sizeof(t_deg2rad), 0, A_DEFFLOAT, 0);
-
- class_addmethod(rad2deg_class, (t_method)rad2deg_help, gensym("help"), 0);
- class_addfloat(rad2deg_class, rad2deg_float);
- class_sethelpsymbol(rad2deg_class, gensym("zexy/deg2rad"));
-}
-
-/* ------------------------ coordinate transformations ----------------------------- */
-
-typedef struct _coordinates
-{
- t_object x_obj;
-
- t_outlet *out[3];
- t_float old_coord[3], new_coord[3];
-} t_coordinates;
-
-void coordinates_free(t_coordinates *x)
-{
-}
-
-void coord_bang(t_coordinates *x)
-{
- int i=3;
- while(i--)outlet_float(x->out[i], x->new_coord[i]);
-}
-
-
-/* cart2pol :: cartesian to polar coordinates */
-t_class *cart2pol_class;
-
-static void cart2pol_bang(t_coordinates *x)
-{
- t_float X=x->old_coord[0], Y=x->old_coord[1];
- x->new_coord[0]=sqrtf(X*X+Y*Y); /* R */
- x->new_coord[1]=atan2f(Y, X); /* PHI */
- x->new_coord[2]=x->old_coord[2]; /* Z */
- coord_bang(x);
-}
-
-static void cart2pol_float(t_coordinates *x, t_float f)
-{
- x->old_coord[0]=f;
- cart2pol_bang(x);
-}
-
-static void *cart2pol_new(t_floatarg X, t_floatarg Y, t_floatarg Z)
-{
- t_coordinates *x = (t_coordinates *)pd_new(cart2pol_class);
- int i=3;
- floatinlet_new(&x->x_obj, &x->old_coord[1]);
- floatinlet_new(&x->x_obj, &x->old_coord[2]);
- while(i--){
- x->out[2-i]=outlet_new(&x->x_obj, gensym("float"));
- x->new_coord[i]=0;
- }
- x->old_coord[0]=X;
- x->old_coord[1]=Y;
- x->old_coord[2]=Z;
-
- return (x);
-}
-
-static void cart2pol_help(void)
-{
- post("cart2pol\t:: convert cartesian to polar coordinates");
- post("\t\"<x> <y> <z>\": returns <r> <phi> <z>");
-}
-
-static void cart2pol_setup(void)
-{
- cart2pol_class = class_new(gensym("cart2pol"), (t_newmethod)cart2pol_new, (t_method)coordinates_free,
- sizeof(t_coordinates), 0, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
-
- class_addmethod(cart2pol_class, (t_method)cart2pol_help, gensym("help"), 0);
- class_addfloat(cart2pol_class, cart2pol_float);
- class_addbang(cart2pol_class, cart2pol_bang);
-
- class_sethelpsymbol(cart2pol_class, gensym("zexy/cart2pol"));
-}
-
-
-/* pol2cart :: polar to cartesian coordinates */
-t_class *pol2cart_class;
-
-static void pol2cart_bang(t_coordinates *x)
-{
- x->new_coord[0]=x->old_coord[0]*cosf(x->old_coord[1]); /* X */
- x->new_coord[1]=x->old_coord[0]*sinf(x->old_coord[1]); /* Y */
- x->new_coord[2]=x->old_coord[2]; /* Z */
- coord_bang(x);
-}
-
-static void pol2cart_float(t_coordinates *x, t_float f)
-{
- x->old_coord[0]=f;
- pol2cart_bang(x);
-}
-
-static void *pol2cart_new(t_floatarg X, t_floatarg Y, t_floatarg Z)
-{
- t_coordinates *x = (t_coordinates *)pd_new(pol2cart_class);
- int i=3;
- floatinlet_new(&x->x_obj, &x->old_coord[1]);
- floatinlet_new(&x->x_obj, &x->old_coord[2]);
- while(i--){
- x->out[2-i]=outlet_new(&x->x_obj, gensym("float"));
- x->new_coord[i]=0;
- }
- x->old_coord[0]=X;
- x->old_coord[1]=Y;
- x->old_coord[2]=Z;
- return (x);
-}
-
-static void pol2cart_help(void)
-{
- post("pol2cart\t:: convert polar to cartesian coordinates");
- post("\t\"<r> <phi> <z>\": returns <x> <x> <z>");
-}
-
-static void pol2cart_setup(void)
-{
- pol2cart_class = class_new(gensym("pol2cart"), (t_newmethod)pol2cart_new, (t_method)coordinates_free,
- sizeof(t_coordinates), 0, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
-
- class_addmethod(pol2cart_class, (t_method)pol2cart_help, gensym("help"), 0);
- class_addfloat(pol2cart_class, pol2cart_float);
- class_addbang(pol2cart_class, pol2cart_bang);
-
- class_sethelpsymbol(pol2cart_class, gensym("zexy/pol2cart"));
-}
-
-/* cart2sph :: cartesian to sphar coordinates */
-t_class *cart2sph_class;
-
-static void cart2sph_bang(t_coordinates *x)
-{
- t_float X=x->old_coord[0], Y=x->old_coord[1], Z=x->old_coord[2];
- x->new_coord[0]=sqrtf(X*X+Y*Y+Z*Z); /* R */
- x->new_coord[1]=atan2f(Y, X); /* PHI */
- x->new_coord[2]=atan2f(Z, sqrt(X*X+Y*Y)); /* THETA */
- coord_bang(x);
-}
-
-static void cart2sph_float(t_coordinates *x, t_float f)
-{
- x->old_coord[0]=f;
- cart2sph_bang(x);
-}
-
-static void *cart2sph_new(t_floatarg X, t_floatarg Y, t_floatarg Z)
-{
- t_coordinates *x = (t_coordinates *)pd_new(cart2sph_class);
- int i=3;
- floatinlet_new(&x->x_obj, &x->old_coord[1]);
- floatinlet_new(&x->x_obj, &x->old_coord[2]);
- while(i--){
- x->out[2-i]=outlet_new(&x->x_obj, gensym("float"));
- x->new_coord[i]=0;
- }
- x->old_coord[0]=X;
- x->old_coord[1]=Y;
- x->old_coord[2]=Z;
- return (x);
-}
-
-static void cart2sph_help(void)
-{
- post("cart2sph\t:: convert cartesian to sphar coordinates");
- post("\t\"<x> <y> <z>\": returns <r> <phi> <theta>");
-}
-
-static void cart2sph_setup(void)
-{
- cart2sph_class = class_new(gensym("cart2sph"), (t_newmethod)cart2sph_new, (t_method)coordinates_free,
- sizeof(t_coordinates), 0, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
-
- class_addmethod(cart2sph_class, (t_method)cart2sph_help, gensym("help"), 0);
- class_addfloat(cart2sph_class, cart2sph_float);
- class_addbang(cart2sph_class, cart2sph_bang);
-
- class_sethelpsymbol(cart2sph_class, gensym("zexy/cart2sph"));
-}
-
-
-/* sph2cart :: sphar to cartesian coordinates */
-t_class *sph2cart_class;
-
-static void sph2cart_bang(t_coordinates *x)
-{
- x->new_coord[0]=x->old_coord[0]*cosf(x->old_coord[1])*cosf(x->old_coord[2]); /* X */
- x->new_coord[1]=x->old_coord[0]*sinf(x->old_coord[1])*cosf(x->old_coord[2]); /* Y */
- x->new_coord[2]=x->old_coord[0]*sinf(x->old_coord[2]); /* Z */
- coord_bang(x);
-}
-
-static void sph2cart_float(t_coordinates *x, t_float f)
-{
- x->old_coord[0]=f;
- sph2cart_bang(x);
-}
-
-static void *sph2cart_new(t_floatarg X, t_floatarg Y, t_floatarg Z)
-{
- t_coordinates *x = (t_coordinates *)pd_new(sph2cart_class);
- int i=3;
- floatinlet_new(&x->x_obj, &x->old_coord[1]);
- floatinlet_new(&x->x_obj, &x->old_coord[2]);
- while(i--){
- x->out[2-i]=outlet_new(&x->x_obj, gensym("float"));
- x->new_coord[i]=0;
- }
- x->old_coord[0]=X;
- x->old_coord[1]=Y;
- x->old_coord[2]=Z;
- return (x);
-}
-
-static void sph2cart_help(void)
-{
- post("sph2cart\t:: convert sphar to cartesian coordinates");
- post("\t\"<r> <phi> <theta>\": returns <x> <y> <z>");
-}
-
-static void sph2cart_setup(void)
-{
- sph2cart_class = class_new(gensym("sph2cart"), (t_newmethod)sph2cart_new, (t_method)coordinates_free,
- sizeof(t_coordinates), 0, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
-
- class_addmethod(sph2cart_class, (t_method)sph2cart_help, gensym("help"), 0);
- class_addfloat(sph2cart_class, sph2cart_float);
- class_addbang(sph2cart_class, sph2cart_bang);
-
- class_sethelpsymbol(sph2cart_class, gensym("zexy/sph2cart"));
-}
-
-
-/* pol2sph :: polesian to sphar coordinates */
-t_class *pol2sph_class;
-
-static void pol2sph_bang(t_coordinates *x)
-{
- t_float r=x->old_coord[0], z=x->old_coord[2];
- x->new_coord[0]=sqrtf(r*r+z*z); /* R */
- x->new_coord[1]=x->old_coord[1]; /* PHI */
- x->new_coord[2]=atan2f(z,r); /* THETA */
- coord_bang(x);
-}
-
-static void pol2sph_float(t_coordinates *x, t_float f)
-{
- x->old_coord[0]=f;
- pol2sph_bang(x);
-}
-
-static void *pol2sph_new(t_floatarg X, t_floatarg Y, t_floatarg Z)
-{
- t_coordinates *x = (t_coordinates *)pd_new(pol2sph_class);
- int i=3;
- floatinlet_new(&x->x_obj, &x->old_coord[1]);
- floatinlet_new(&x->x_obj, &x->old_coord[2]);
- while(i--){
- x->out[2-i]=outlet_new(&x->x_obj, gensym("float"));
- x->new_coord[i]=0;
- }
- x->old_coord[0]=X;
- x->old_coord[1]=Y;
- x->old_coord[2]=Z;
- return (x);
-}
-
-static void pol2sph_help(void)
-{
- post("pol2sph\t:: convert polar to spheric coordinates");
- post("\t\"<r> <phi> <z>\": returns <r> <phi> <theta>");
-}
-
-static void pol2sph_setup(void)
-{
- pol2sph_class = class_new(gensym("pol2sph"), (t_newmethod)pol2sph_new, (t_method)coordinates_free,
- sizeof(t_coordinates), 0, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
-
- class_addmethod(pol2sph_class, (t_method)pol2sph_help, gensym("help"), 0);
- class_addfloat(pol2sph_class, pol2sph_float);
- class_addbang(pol2sph_class, pol2sph_bang);
-
- class_sethelpsymbol(pol2sph_class, gensym("zexy/pol2sph"));
-}
-
-
-/* sph2pol :: sphar to polesian coordinates */
-t_class *sph2pol_class;
-
-static void sph2pol_bang(t_coordinates *x)
-{
- x->new_coord[0]=x->old_coord[0]*cosf(x->old_coord[2]); /* R */
- x->new_coord[1]=x->old_coord[1]; /* PHI */
- x->new_coord[2]=x->old_coord[0]*sinf(x->old_coord[2]); /* Z */
-
- coord_bang(x);
-}
-
-static void sph2pol_float(t_coordinates *x, t_float f)
-{
- x->old_coord[0]=f;
- sph2pol_bang(x);
-}
-
-static void *sph2pol_new(t_floatarg X, t_floatarg Y, t_floatarg Z)
-{
- t_coordinates *x = (t_coordinates *)pd_new(sph2pol_class);
- int i=3;
- floatinlet_new(&x->x_obj, &x->old_coord[1]);
- floatinlet_new(&x->x_obj, &x->old_coord[2]);
- while(i--){
- x->out[2-i]=outlet_new(&x->x_obj, gensym("float"));
- x->new_coord[i]=0;
- }
- x->old_coord[0]=X;
- x->old_coord[1]=Y;
- x->old_coord[2]=Z;
- return (x);
-}
-
-static void sph2pol_help(void)
-{
- post("sph2pol\t:: convert spherical to polar coordinates");
- post("\t\"<r> <phi> <theta>\": returns <r> <phi> <z>");
-}
-
-static void sph2pol_setup(void)
-{
- sph2pol_class = class_new(gensym("sph2pol"), (t_newmethod)sph2pol_new, (t_method)coordinates_free,
- sizeof(t_coordinates), 0, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
-
- class_addmethod(sph2pol_class, (t_method)sph2pol_help, gensym("help"), 0);
- class_addfloat(sph2pol_class, sph2pol_float);
- class_addbang(sph2pol_class, sph2pol_bang);
-
- class_sethelpsymbol(sph2pol_class, gensym("zexy/sph2pol"));
-}
-
-/* global setup routine */
-
-void z_coordinates_setup(void)
-{
- cart2pol_setup();
- pol2cart_setup();
- cart2sph_setup();
- sph2cart_setup();
- pol2sph_setup();
- sph2pol_setup();
-
- deg2rad_setup();
- rad2deg_setup();
-}
diff --git a/src/z_matrix.c b/src/z_matrix.c
deleted file mode 100644
index a84fa4d..0000000
--- a/src/z_matrix.c
+++ /dev/null
@@ -1,2706 +0,0 @@
-/* 2504:forum::für::umläute:2001 */
-
-/* objects for manipulating matrices */
-/* mostly i refer to matlab/octave matrix functions */
-
-/*
- matrix : basic object : create and store matrices
- mtx : alias for matrix
-
- mtx_resize
- mtx_row
- mtx_col
- mtx_element
-
- mtx_ones
- mtx_zeros
- mtx_eye
- mtx_egg
-
- mtx_diag
- mtx_diegg
- mtx_trace
-
- mtx_mean
- mtx_rand
-
- mtx_transpose
- mtx_scroll
- mtx_roll
-
- mtx_add
- mtx_+
- mtx_mul
- mtx_*
- mtx_.*
- mtx_./
-
- mtx_inverse
- mtx_pivot
-
- mtx_size
-
- mtx_check
- mtx_print
-*/
-
-#define MY_WRITE
-
-#define T_FLOAT long double
-
-#include "zexy.h"
-#include <math.h>
-
-#ifdef MY_WRITE
-#include <stdio.h>
-#endif
-#include <string.h>
-
-#ifdef NT
-#include <memory.h>
-#define fabsf fabs
-#pragma warning( disable : 4244 )
-#pragma warning( disable : 4305 )
-#endif
-
-
-/* -------------------- matrix ------------------------------ */
-
-static t_class *matrix_class;
-
-typedef struct _matrix
-{
- t_object x_obj;
-
- int row;
- int col;
-
- t_atom *atombuffer;
-
- int current_row, current_col; /* this makes things easy for the mtx_row & mtx_col...*/
- t_float f;
-
- t_canvas *x_canvas;
-} t_matrix;
-
-/* intern utility functions */
-
-static void setdimen(t_matrix *x, int row, int col)
-{
- x->col = col;
- x->row = row;
- SETFLOAT(x->atombuffer, row);
- SETFLOAT(x->atombuffer+1, col);
-}
-
-static void adjustsize(t_matrix *x, int desiredRow, int desiredCol)
-{
- int col=x->col, row=x->row;
-
- if (desiredRow<1){
- post("cannot make less than 1 rows");
- desiredRow=1;
- }
- if (desiredCol<1){
- post("cannot make less than 1 columns");
- desiredCol=1;
- }
-
- if (col*row!=desiredRow*desiredCol){
- if(x->atombuffer)freebytes(x->atombuffer, (col*row+2)*sizeof(t_atom));
- x->atombuffer=(t_atom *)getbytes((desiredCol*desiredRow+2)*sizeof(t_atom));
- }
-
- setdimen(x, desiredRow, desiredCol);
- return;
-}
-
-static void debugmtx(int argc, t_float *buf, int id)
-{
- int i=argc;
- while(i--){
- int j=argc;
- startpost("debug%d: ", id);
- while(j--)
- startpost("%f ", *buf++);
- endpost();
- }
-}
-static T_FLOAT *matrix2float(t_atom *ap)
-{
- int row = atom_getfloat(ap++);
- int col=atom_getfloat(ap++);
- int length = row * col;
- T_FLOAT *buffer = (T_FLOAT *)getbytes(sizeof(T_FLOAT)*length);
- T_FLOAT *buf = buffer;
- while(length--)*buf++=atom_getfloat(ap++);
- return buffer;
-}
-static void float2matrix(t_atom *ap, T_FLOAT *buffer)
-{
- int row=atom_getfloat(ap++);
- int col=atom_getfloat(ap++);
- int length = row * col;
- T_FLOAT*buf= buffer;
- while(length--){
- SETFLOAT(ap, *buf++);
- ap++;
- }
- freebytes(buffer, row*col*sizeof(T_FLOAT));
-}
-
-
-/* core functions */
-
-static void matrix_bang(t_matrix *x)
-{
- /* output the matrix */
- if (x->atombuffer)outlet_anything(x->x_obj.ob_outlet, gensym("matrix"), x->col*x->row+2, x->atombuffer);
-}
-
-static void matrix_matrix2(t_matrix *x, t_symbol *s, int argc, t_atom *argv)
-{
- int row, col;
-
- if (argc<2){
- post("matrix : corrupt matrix passed");
- return;
- }
- row = atom_getfloat(argv);
- col = atom_getfloat(argv+1);
- if ((row<1)||(col<1)){
- post("matrix : corrupt matrix passed");
- return;
- }
- if (row*col > argc-2){
- post("matrix: sparse matrices not yet supported : use \"mtx_check\"");
- return;
- }
-
- /* this is fast and dirty, MAYBE make it slow and clean */
- /* or, to clean matrices, use the mtx_check object */
- if (row*col != x->row*x->col) {
- freebytes(x->atombuffer, x->row*x->col*sizeof(t_atom));
- x->atombuffer = copybytes(argv, (row*col+2)*sizeof(t_atom));
- } else memcpy(x->atombuffer, argv, (row*col+2)*sizeof(t_atom));
-
- setdimen(x, row, col);
-}
-
-static void matrix_matrix(t_matrix *x, t_symbol *s, int argc, t_atom *argv)
-{
- int row, col;
-
- if (argc<2){
- post("matrix : corrupt matrix passed");
- return;
- }
- row = atom_getfloat(argv);
- col = atom_getfloat(argv+1);
- if ((row<1)||(col<1)){
- post("matrix : corrupt matrix passed");
- return;
- }
- if (row*col > argc-2){
- post("matrix: sparse matrices not yet supported : use \"mtx_check\"");
- return;
- }
-
- matrix_matrix2(x, s, argc, argv);
- matrix_bang(x);
-}
-
-
-/* basic functions */
-
-static void matrix_set(t_matrix *x, t_float f)
-{
- int size = x->col * x->row;
- t_atom *buf=x->atombuffer+2;
- if(x->atombuffer)while(size--)SETFLOAT(&buf[size], f);
-}
-
-static void matrix_zeros(t_matrix *x, t_symbol *s, int argc, t_atom *argv)
-{
- int col, row;
-
- switch(argc) {
- case 0: /* zero out the actual matrix */
- matrix_set(x, 0);
- break;
- case 1:
- row=atom_getfloat(argv);
- adjustsize(x, row, row);
- matrix_set(x, 0);
- break;
- default:
- row=atom_getfloat(argv++);
- col=atom_getfloat(argv);
- adjustsize(x, row, col);
-
- matrix_set(x, 0);
- }
-
- matrix_bang(x);
-}
-
-static void matrix_ones(t_matrix *x, t_symbol *s, int argc, t_atom *argv)
-{
- int col, row;
-
- switch(argc) {
- case 0: /* zero out the actual matrix */
- matrix_set(x, 1);
- break;
- case 1:
- row=atom_getfloat(argv);
- adjustsize(x, row, row);
- matrix_set(x, 1);
- break;
- default:
- row=atom_getfloat(argv++);
- col=atom_getfloat(argv);
- adjustsize(x, row, col);
-
- matrix_set(x, 1);
- }
-
- matrix_bang(x);
-}
-
-static void matrix_eye(t_matrix *x, t_symbol *s, int argc, t_atom *argv)
-{
- int col, row;
- int n;
-
- switch(argc) {
- case 0: /* zero out the actual matrix */
- matrix_set(x, 0);
- break;
- case 1:
- row=atom_getfloat(argv);
- adjustsize(x, row, row);
- matrix_set(x, 0);
- break;
- default:
- row=atom_getfloat(argv++);
- col=atom_getfloat(argv);
- adjustsize(x, row, col);
- matrix_set(x, 0);
- }
-
- col=x->col;
- row=x->row;
- n = (col<row)?col:row;
- while(n--)SETFLOAT(x->atombuffer+2+n*(1+col), 1);
-
- matrix_bang(x);
-}
-static void matrix_egg(t_matrix *x, t_symbol *s, int argc, t_atom *argv)
-{
- int col, row;
- int n;
-
- switch(argc) {
- case 0: /* zero out the actual matrix */
- matrix_set(x, 0);
- break;
- case 1:
- row=atom_getfloat(argv);
- adjustsize(x, row, row);
- matrix_set(x, 0);
- break;
- default:
- row=atom_getfloat(argv++);
- col=atom_getfloat(argv);
- adjustsize(x, row, col);
- matrix_set(x, 0);
- }
-
- col=x->col;
- row=x->row;
- n = (col<row)?col:row;
- while(n--)SETFLOAT(x->atombuffer+2+(n+1)*(col-1), 1);
-
- matrix_bang(x);
-}
-
-static void matrix_diag(t_matrix *x, t_symbol *s, int argc, t_atom *argv)
-{
- int col=argc;
- argv+=argc-1;
- if (argc<1) {
- post("matrix: no diagonale present");
- return;
- }
- adjustsize(x, argc, argc);
- matrix_set(x, 0);
-
- while(argc--)SETFLOAT(x->atombuffer+2+argc*(1+col), atom_getfloat(argv--));
-
- matrix_bang(x);
-}
-static void matrix_diegg(t_matrix *x, t_symbol *s, int argc, t_atom *argv)
-{
- int col=argc;
- argv+=argc-1;
- if (argc<1) {
- post("matrix: no dieggonale present");
- return;
- }
- adjustsize(x, argc, argc);
- matrix_set(x, 0);
-
- while(argc--){
- t_atom *ap=x->atombuffer+2+(argc+1)*(col-1);
- SETFLOAT(ap, atom_getfloat(argv--));
- }
-
- matrix_bang(x);
-}
-/* the rest */
-
-static void matrix_row(t_matrix *x, t_symbol *s, int argc, t_atom *argv)
-{
- t_atom *ap;
- int row=x->row, col=x->col;
- int r;
- t_float f;
-
- switch (argc){
- case 0:
- for (r=0;r<row;r++)outlet_list(x->x_obj.ob_outlet, gensym("row"), col, x->atombuffer+r*col+2);
- break;
- case 1:
- r=atom_getfloat(argv)-1;
- if ((r<0)||(r>=row)){
- post("matrix: row index %d is out of range", r+1);
- return;
- }
- outlet_list(x->x_obj.ob_outlet, gensym("row"), col, x->atombuffer+r*col+2);
- break;
- case 2:
- r=atom_getfloat(argv)-1;
- f=atom_getfloat(argv+1);
- if ((r<0)||(r>=row)){
- post("matrix: row index %d is out of range", r+1);
- return;
- }
-
-
- default:
- r=atom_getfloat(argv++)-1;
- if (argc--<col){
- post("matrix: sparse rows not yet supported : use \"mtx_check\"");
- return;
- }
- if ((r<0)||(r>=row)){
- post("matrix: row index %d is out of range", r+1);
- return;
- }
- if (r==row) {
- } else {
- ap=x->atombuffer+2+col*r;
- memcpy(ap, argv, col*sizeof(t_atom));
- }
- }
-}
-
-static void matrix_col(t_matrix *x, t_symbol *s, int argc, t_atom *argv)
-{
- t_atom *ap;
- int row=x->row, col=x->col;
- int c, r;
-
- switch (argc){
- case 0:
- ap=(t_atom *)getbytes(row*sizeof(t_atom));
- for (c=0;c<col;c++) {
- for (r=0;r<row;r++)SETFLOAT(&ap[r], atom_getfloat(x->atombuffer+2+c+col*r));
- outlet_list(x->x_obj.ob_outlet, gensym("col"), row, ap);
- }
- freebytes(ap, row*sizeof(t_atom));
- break;
- case 1:
- ap=(t_atom *)getbytes(row*sizeof(t_atom));
- c=atom_getfloat(argv)-1;
- if ((c<0)||(c>=col)){
- post("matrix: col index %d is out of range", c+1);
- return;
- }
- for (r=0;r<row;r++)SETFLOAT(&ap[r], atom_getfloat(x->atombuffer+2+c+col*r));
- outlet_list(x->x_obj.ob_outlet, gensym("col"), row, ap);
- freebytes(ap, row*sizeof(t_atom));
- break;
- default:
- c=atom_getfloat(argv++)-1;
- if (argc--<row){
- post("matrix: sparse cols not yet supported : use \"mtx_check\"");
- return;
- }
- if ((c<0)||(c>=col)){
- post("matrix: col index %d is out of range", c+1);
- return;
- }
- argv+=argc-1;
- if (argc>row)argc=row;
- while(argc--){
- ap=x->atombuffer+2+c+col*argc;
- SETFLOAT(ap, atom_getfloat(argv--));
- }
- }
-}
-
-static void matrix_element(t_matrix *x, t_symbol *s, int argc, t_atom *argv)
-{
- t_atom *ap=x->atombuffer+2;
- int row=x->row, col=x->col;
- int r, c, i=row*col;
-
- switch (argc){
- case 0:
- while(i--)outlet_float(x->x_obj.ob_outlet, atom_getfloat(ap++));
- break;
- case 1:
- r=c=atom_getfloat(argv)-1;
- if ((r<0)||(r>=row)){
- post("matrix: row index %d is out of range", r+1);
- return;
- }
- if ((c<0)||(c>=col)){
- post("matrix: col index %d is out of range", c+1);
- return;
- }
- outlet_float(x->x_obj.ob_outlet, atom_getfloat(x->atombuffer+2+c+r*col));
- break;
- case 2:
- r=atom_getfloat(argv++)-1;
- c=atom_getfloat(argv++)-1;
- if ((r<0)||(r>=row)){ post("matrix: row index %d is out of range", r+1); return; }
- if ((c<0)||(c>=col)){ post("matrix: col index %d is out of range", c+1); return; }
- outlet_float(x->x_obj.ob_outlet, atom_getfloat(x->atombuffer+2+c+r*col));
- break;
- default:
- r=atom_getfloat(argv++)-1;
- c=atom_getfloat(argv++)-1;
- if ((r<0)||(r>=row)){ post("matrix: row index %d is out of range", r+1); return; }
- if ((c<0)||(c>=col)){ post("matrix: col index %d is out of range", c+1); return; }
- SETFLOAT(x->atombuffer+2+c+r*col, atom_getfloat(argv));
- }
-}
-
-static void matrix_float(t_matrix *x, t_float f)
-{
- matrix_set(x, f);
- matrix_bang(x);
-}
-
-/* ------------- file I/O ------------------ */
-
-static void matrix_read(t_matrix *x, t_symbol *filename)
-{
- t_binbuf *bbuf = binbuf_new();
- t_atom *ap;
- int n;
-
- if (binbuf_read_via_path(bbuf, filename->s_name, canvas_getdir(x->x_canvas)->s_name, 0))
- error("matrix: failed to read %s", filename->s_name);
-
- ap=binbuf_getvec(bbuf);
- n =binbuf_getnatom(bbuf)-1;
-
- if ((ap->a_type == A_SYMBOL) &&
- (!strcmp(ap->a_w.w_symbol->s_name,"matrix") || !strcmp(ap->a_w.w_symbol->s_name,"#matrix")) ){
- matrix_matrix2(x, gensym("matrix"), n, ap+1);
- }
-
- binbuf_free(bbuf);
-}
-#ifndef MY_WRITE
-static void matrix_write(t_matrix *x, t_symbol *filename)
-{
- t_binbuf *bbuf = binbuf_new();
- t_atom atom, *ap=x->atombuffer;
- char buf[MAXPDSTRING];
- int n = x->row;
-
- canvas_makefilename(x->x_canvas, filename->s_name, buf, MAXPDSTRING);
-
- /* we now write "#matrix" instead of "matrix",
- * so that these files can easily read by other
- * applications such as octave
- */
- SETSYMBOL(&atom, gensym("#matrix"));
- binbuf_add(bbuf, 1, &atom);
- binbuf_add(bbuf, 2, ap);
- binbuf_addsemi(bbuf);
- ap+=2;
- while(n--){
- binbuf_add(bbuf, x->col, ap);
- binbuf_addsemi(bbuf);
- ap+=x->col;
- }
-
- if (binbuf_write(bbuf, buf, "", 1)){
- error("matrix: failed to write %s", filename->s_name);
- }
-
- binbuf_free(bbuf);
-}
-#else
-static void matrix_write(t_matrix *x, t_symbol *filename)
-{
- t_atom *ap=x->atombuffer+2;
- char filnam[MAXPDSTRING];
- int rows = x->row, cols = x->col;
- FILE *f=0;
-
- sys_bashfilename(filename->s_name, filnam);
-
- /* open file */
- if (!(f = fopen(filnam, "w"))) {
- error("matrix : failed to open %s", filnam);
- } else {
- char *text=(char *)getbytes(sizeof(char)*MAXPDSTRING);
- int textlen;
-
- /* header:
- * we now write "#matrix" instead of "matrix",
- * so that these files can easily read by other
- * applications such as octave
- */
- sprintf(text, "#matrix %d %d\n", rows, cols);
- textlen = strlen(text);
- if (fwrite(text, textlen*sizeof(char), 1, f) < 1) {
- error("matrix : failed to write %s", filnam); goto end;
- }
-
- while(rows--) {
- int c = cols;
- while (c--) {
- t_float val = atom_getfloat(ap++);
- sprintf(text, "%.15f ", val);
- textlen=strlen(text);
- if (fwrite(text, textlen*sizeof(char), 1, f) < 1) {
- error("matrix : failed to write %s", filnam); goto end;
- }
- }
- if (fwrite("\n", sizeof(char), 1, f) < 1) {
- error("matrix : failed to write %s", filnam); goto end;
- }
- }
- freebytes(text, sizeof(char)*MAXPDSTRING);
- }
-
- end:
- /* close file */
- if (f) fclose(f);
-}
-#endif
-
-static void matrix_free(t_matrix *x)
-{
- freebytes(x->atombuffer, (x->col*x->row+2)*sizeof(t_atom));
- x->atombuffer=0;
- x->col=x->row=0;
-}
-static void matrix_list(t_matrix *x, t_symbol *s, int argc, t_atom *argv)
-{
- /* like matrix, but without col/row information, so the previous size is kept */
- int row=x->row, col=x->col;
-
- if(!row*col){
- post("matrix : unknown matrix dimensions");
- return;
- }
- if (argc<row*col){
- post("matrix: sparse matrices not yet supported : use \"mtx_check\" !");
- return;
- }
-
- memcpy(x->atombuffer+2, argv, row*col*sizeof(t_atom));
- matrix_bang(x);
-}
-
-static void *matrix_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_matrix *x = (t_matrix *)pd_new(matrix_class);
- int row, col;
-
-
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("matrix"), gensym(""));
- outlet_new(&x->x_obj, 0);
-
- x->atombuffer = 0;
- x->x_canvas = canvas_getcurrent();
-
- switch (argc) {
- case 0:
- row = col = 0;
- break;
- case 1:
- if (argv->a_type == A_SYMBOL) {
- matrix_read(x, argv->a_w.w_symbol);
- return(x);
- }
- row = col = atom_getfloat(argv);
- break;
- default:
- row = atom_getfloat(argv++);
- col = atom_getfloat(argv++);
- }
-
- if(row*col){
- adjustsize(x, row, col);
- matrix_set(x, 0);
- }
-
- return (x);
-}
-
-static void matrix_setup(void)
-{
- matrix_class = class_new(gensym("matrix"), (t_newmethod)matrix_new,
- (t_method)matrix_free, sizeof(t_matrix), 0, A_GIMME, 0);
- class_addcreator((t_newmethod)matrix_new, gensym("mtx"), A_GIMME, 0);
-
- /* the core : functions for matrices */
- class_addmethod (matrix_class, (t_method)matrix_matrix, gensym("matrix"), A_GIMME, 0);
- class_addmethod (matrix_class, (t_method)matrix_matrix2, gensym(""), A_GIMME, 0);
-
- /* the basics : functions for creation */
- class_addmethod (matrix_class, (t_method)matrix_eye, gensym("eye"), A_GIMME, 0);
- class_addmethod (matrix_class, (t_method)matrix_diag, gensym("diag"), A_GIMME, 0);
- class_addmethod (matrix_class, (t_method)matrix_ones, gensym("ones"), A_GIMME, 0);
- class_addmethod (matrix_class, (t_method)matrix_zeros, gensym("zeros"), A_GIMME, 0);
- class_addmethod (matrix_class, (t_method)matrix_egg, gensym("egg"), A_GIMME, 0);
- class_addmethod (matrix_class, (t_method)matrix_diegg, gensym("diegg"), A_GIMME, 0);
-
- /* the rest : functions for anything */
- class_addbang (matrix_class, matrix_bang);
- class_addfloat (matrix_class, matrix_float);
- class_addlist (matrix_class, matrix_list);
- class_addmethod (matrix_class, (t_method)matrix_row, gensym("row"), A_GIMME, 0);
- class_addmethod (matrix_class, (t_method)matrix_col, gensym("column"), A_GIMME, 0);
- class_addmethod (matrix_class, (t_method)matrix_col, gensym("col"), A_GIMME, 0);
- class_addmethod (matrix_class, (t_method)matrix_element, gensym("element"), A_GIMME, 0);
-
- /* the file functions */
- class_addmethod (matrix_class, (t_method)matrix_write, gensym("write"), A_SYMBOL, 0);
- class_addmethod (matrix_class, (t_method)matrix_read , gensym("read") , A_SYMBOL, 0);
-
-
- class_sethelpsymbol(matrix_class, gensym("zexy/matrix"));
-}
-
-
-/* ------------------------------------------------------------------------------------- */
-
-/* mtx_resize */
-
-static t_class *mtx_resize_class;
-static void mtx_resize_list2(t_matrix *x, t_symbol *s, int argc, t_atom *argv)
-{
- int r, c;
- if (argc<1)return;
- if (argc>2)error("mtx_resize : only rows & cols are needed, skipping the rest");
- if (argc==1)r=c=atom_getfloat(argv++);
- else{
- r=atom_getfloat(argv++);
- c=atom_getfloat(argv++);
- }
-
- if (r<0)r=0;
- if (c<0)c=0;
-
- x->current_row = r;
- x->current_col = c;
-}
-
-static void mtx_resize_matrix(t_matrix *x, t_symbol *s, int argc, t_atom *argv)
-{
- int row=atom_getfloat(argv);
- int col=atom_getfloat(argv+1);
- int r = x->current_row, c = x->current_col;
- int R=0, ROW, COL;
-
- if (argc<2){ post("mtx_add: crippled matrix"); return; }
- if ((col<1)||(row<1)) { post("mtx_add: invalid dimensions"); return; }
- if (col*row>argc-2){ post("sparse matrix not yet supported : use \"mtx_check\""); return; }
-
- if (!r)r=row;
- if (!c)c=col;
-
- if (r==row && c==col) { // no need to change
- outlet_anything(x->x_obj.ob_outlet, gensym("matrix"), argc, argv);
- return;
- }
-
- x->atombuffer=(t_atom *)getbytes((c*r+2)*sizeof(t_atom));
- setdimen(x, r, c);
- matrix_set(x, 0);
-
- ROW=(r<row)?r:row;
- COL=(c<col)?c:col;
- R=ROW;
- while(R--)memcpy(x->atombuffer+2+(ROW-R-1)*c, argv+2+(ROW-R-1)*col, COL*sizeof(t_atom));
-
- matrix_bang(x);
-
- freebytes(x->atombuffer, (c*r+2)*sizeof(t_atom));
-}
-
-static void *mtx_resize_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_matrix *x = (t_matrix *)pd_new(mtx_resize_class);
- int c=0, r=0;
-
- if(argc){
- if(argc-1){
- r=atom_getfloat(argv);
- c=atom_getfloat(argv+1);
- } else r=c=atom_getfloat(argv);
- if(c<0)c=0;
- if(r<0)r=0;
- }
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"), gensym(""));
- outlet_new(&x->x_obj, 0);
- x->current_row = r;
- x->current_col = c;
- x->row = x->col= 0;
- x->atombuffer = 0;
-
- return (x);
-}
-static void mtx_resize_setup(void)
-{
- mtx_resize_class = class_new(gensym("mtx_resize"), (t_newmethod)mtx_resize_new,
- 0, sizeof(t_matrix), 0, A_GIMME, 0);
- class_addmethod (mtx_resize_class, (t_method)mtx_resize_matrix, gensym("matrix"), A_GIMME, 0);
- class_addmethod (mtx_resize_class, (t_method)mtx_resize_list2, gensym(""), A_GIMME, 0);
- class_sethelpsymbol(mtx_resize_class, gensym("zexy/mtx_size"));
-}
-
-/* mtx_row */
-static t_class *mtx_row_class;
-
-static void mtx_row_float(t_matrix *x, t_floatarg f)
-{
- int i = f;
- if(i<0)i=0;
- x->current_row = i;
-}
-static void mtx_row_matrix(t_matrix *x, t_symbol *s, int argc, t_atom *argv)
-{
- int row, col;
- if (argc<2){ post("matrix : corrupt matrix passed"); return; }
- row = atom_getfloat(argv);
- col = atom_getfloat(argv+1);
- if ((row<1)||(col<1)){ post("matrix : corrupt matrix passed"); return; }
- if (row*col > argc-2){ post("matrix: sparse matrices not yet supported : use \"mtx_check\""); return; }
- matrix_matrix2(x, s, argc, argv);
- matrix_bang(x);
-}
-static void mtx_row_list(t_matrix *x, t_symbol *s, int argc, t_atom *argv)
-{
- if (argc==1){
- t_float f=atom_getfloat(argv);
- t_atom *ap=x->atombuffer+2+(x->current_row-1)*x->col;
- if (x->current_row>x->row){
- post("mtx_row : too high a row is to be set");
- return;
- }
- if (x->current_row){
- int n=x->col;
- while(n--){
- SETFLOAT(ap, f);
- ap++;
- }
- }
- matrix_bang(x);
- return;
- }
-
- if (argc<x->col){
- post("mtx_row : row length is too small for %dx%d-matrix", x->row, x->col);
- return;
- }
- if (x->current_row>x->row){
- post("mtx_row : too high a row is to be set");
- return;
- }
- if(x->current_row) {memcpy(x->atombuffer+2+(x->current_row-1)*x->col, argv, x->col*sizeof(t_atom));
- } else {
- int r=x->row;
- while(r--)memcpy(x->atombuffer+2+r*x->col, argv, x->col*sizeof(t_atom));
- }
- matrix_bang(x);
-}
-static void *mtx_row_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_matrix *x = (t_matrix *)pd_new(mtx_row_class);
- int i, j, q;
-
- outlet_new(&x->x_obj, 0);
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"), gensym(""));
- x->current_row=0;
- x->col=x->row=0;
- x->atombuffer=0;
- switch (argc) {
- case 0:break;
- case 1:
- i = atom_getfloat(argv);
- if (i<0)i=0;
- if(i)adjustsize(x, i, i);
- matrix_set(x, 0);
- break;
- case 2:
- i = atom_getfloat(argv++);if(i<0)i=0;
- j = atom_getfloat(argv++);if(j<0)j=0;
- if(i*j)adjustsize(x, i, j);
- matrix_set(x, 0);
- break;
- default:
- i = atom_getfloat(argv++);if(i<0)i=0;
- j = atom_getfloat(argv++);if(j<0)j=0;
- q = atom_getfloat(argv++);if(q<0)q=0;
- if(i*j)adjustsize(x, i, j);
- matrix_set(x, 0);
- x->current_row=q;
- }
- return (x);
-}
-static void mtx_row_setup(void)
-{
- mtx_row_class = class_new(gensym("mtx_row"), (t_newmethod)mtx_row_new,
- (t_method)matrix_free, sizeof(t_matrix), 0, A_GIMME, 0);
- class_addbang (mtx_row_class, matrix_bang);
- class_addlist (mtx_row_class, mtx_row_list);
- class_addmethod(mtx_row_class, (t_method)mtx_row_matrix, gensym("matrix"), A_GIMME, 0);
- class_addmethod(mtx_row_class, (t_method)mtx_row_float, gensym(""), A_FLOAT, 0);
- class_sethelpsymbol(mtx_row_class, gensym("zexy/mtx_element"));
-}
-
-
-/* mtx_col */
-static t_class *mtx_col_class;
-
-static void mtx_col_float(t_matrix *x, t_floatarg f)
-{
- int i = f;
- if(i<0)i=0;
- x->current_col = i;
-}
-static void mtx_col_matrix(t_matrix *x, t_symbol *s, int argc, t_atom *argv)
-{
- int row, col;
- if (argc<2){ post("matrix : corrupt matrix passed"); return; }
- row = atom_getfloat(argv);
- col = atom_getfloat(argv+1);
- if ((row<1)||(col<1)){ post("matrix : corrupt matrix passed"); return; }
- if (row*col > argc-2){ post("matrix: sparse matrices not yet supported : use \"mtx_check\""); return; }
- matrix_matrix2(x, s, argc, argv);
- matrix_bang(x);
-}
-static void mtx_col_list(t_matrix *x, t_symbol *s, int argc, t_atom *argv)
-{
- if (argc==1){
- t_float f=atom_getfloat(argv);
- t_atom *ap=x->atombuffer+1+x->current_col;
- if (x->current_col>x->col){
- post("mtx_col : too high a column is to be set");
- return;
- }
- if (x->current_col){
- int n=x->row;
- while(n--){
- SETFLOAT(ap, f);
- ap+=x->row+1;
- }
- }
- matrix_bang(x);
- return;
- }
-
- if (argc<x->row){
- post("mtx_col : column length is too small for %dx%d-matrix", x->row, x->col);
- return;
- }
- if (x->current_col>x->col){
- post("mtx_col : too high a column is to be set");
- return;
- }
- if(x->current_col) {
- int r=x->row;
- t_atom *ap=x->atombuffer+1+x->current_col;
- while(r--)SETFLOAT(&ap[(x->row-r-1)*x->col], atom_getfloat(argv++));
- } else {
- int r=x->row;
- t_atom *ap=x->atombuffer+2;
- while (r--) {
- t_float f=atom_getfloat(argv++);
- int c=x->col;
- while(c--){
- SETFLOAT(ap, f);
- ap++;
- }
- }
- }
- matrix_bang(x);
-}
-static void *mtx_col_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_matrix *x = (t_matrix *)pd_new(mtx_col_class);
- int i, j, q;
- outlet_new(&x->x_obj, 0);
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"), gensym(""));
- x->current_col=0;
- x->col=x->row=0;
- x->atombuffer=0;
- switch (argc) {
- case 0:break;
- case 1:
- i = atom_getfloat(argv);
- if (i<0)i=0;
- if(i)adjustsize(x, i, i);
- matrix_set(x, 0);
- break;
- case 2:
- i = atom_getfloat(argv++);if(i<0)i=0;
- j = atom_getfloat(argv++);if(j<0)j=0;
- if(i*j)adjustsize(x, i, j);
- matrix_set(x, 0);
- break;
- default:
- i = atom_getfloat(argv++);if(i<0)i=0;
- j = atom_getfloat(argv++);if(j<0)j=0;
- q = atom_getfloat(argv++);if(q<0)q=0;
- if(i*j)adjustsize(x, i, j);
- matrix_set(x, 0);
- x->current_col=q;
- }
- return (x);
-}
-static void mtx_col_setup(void)
-{
- mtx_col_class = class_new(gensym("mtx_col"), (t_newmethod)mtx_col_new,
- (t_method)matrix_free, sizeof(t_matrix), 0, A_GIMME, 0);
- class_addbang (mtx_col_class, matrix_bang);
- class_addlist (mtx_col_class, mtx_col_list);
- class_addmethod(mtx_col_class, (t_method)mtx_col_matrix, gensym("matrix"), A_GIMME, 0);
- class_addmethod(mtx_col_class, (t_method)mtx_col_float, gensym(""), A_FLOAT, 0);
- class_sethelpsymbol(mtx_col_class, gensym("zexy/mtx_element"));
-}
-
-/* mtx_element */
-static t_class *mtx_element_class;
-
-static void mtx_element_list2(t_matrix *x, t_floatarg f1, t_floatarg f2)
-{
- int r = f1, c= f2;
- if(r<0)r=0;
- if(c<0)c=0;
- x->current_row = r;
- x->current_col = c;
-}
-static void mtx_element_matrix(t_matrix *x, t_symbol *s, int argc, t_atom *argv)
-{
- int row, col;
- if (argc<2){ post("matrix : corrupt matrix passed"); return; }
- row = atom_getfloat(argv);
- col = atom_getfloat(argv+1);
- if ((row<1)||(col<1)){ post("matrix : corrupt matrix passed"); return; }
- if (row*col > argc-2){ post("matrix: sparse matrices not yet supported : use \"mtx_check\""); return; }
- matrix_matrix2(x, s, argc, argv);
- matrix_bang(x);
-}
-static void mtx_element_float(t_matrix *x, t_floatarg f)
-{
- if(x->current_col>x->col || x->current_row>x->row){
- error("mtx_element: element position exceeds matrix dimensions");
- return;
- }
- if(x->current_row == 0 && x->current_col == 0){
- matrix_set(x, f);
- matrix_bang(x);
- return;
- }
- if(x->current_row*x->current_col)SETFLOAT(x->atombuffer+1+(x->current_row-1)*x->col+x->current_col, f);
- else {
- t_atom *ap=x->atombuffer+2;
- int count;
- if (!x->current_col){
- ap+=x->col*(x->current_row-1);
- count=x->col;
- while(count--)SETFLOAT(&ap[count], f);
- } else { // x->current_row==0
- ap+=x->current_col-1;
- count=x->row;
- while(count--)SETFLOAT(&ap[count*x->col], f);
- }
- }
- matrix_bang(x);
-}
-
-static void *mtx_element_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_matrix *x = (t_matrix *)pd_new(mtx_element_class);
- int i, j, q;
- outlet_new(&x->x_obj, 0);
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"), gensym(""));
- x->current_row=x->current_col=0;
- x->col=x->row=0;
- x->atombuffer=0;
- switch (argc) {
- case 1:
- i = atom_getfloat(argv);
- if (i<0)i=0;
- if(i)adjustsize(x, i, i);
- matrix_set(x, 0);
- break;
- case 2:
- i = atom_getfloat(argv++);if(i<0)i=0;
- j = atom_getfloat(argv++);if(j<0)j=0;
- if(i*j)adjustsize(x, i, j);
- matrix_set(x, 0);
- break;
- case 4:
- i = atom_getfloat(argv++);if(i<0)i=0;
- j = atom_getfloat(argv++);if(j<0)j=0;
- if(i*j)adjustsize(x, i, j);
- matrix_set(x, 0);
- q = atom_getfloat(argv++);if(q<0)q=0;
- x->current_row=q;
- q = atom_getfloat(argv++);if(q<0)q=0;
- x->current_col=q;
- break;
- default:;
- }
- return (x);
-}
-static void mtx_element_setup(void)
-{
- mtx_element_class = class_new(gensym("mtx_element"), (t_newmethod)mtx_element_new,
- (t_method)matrix_free, sizeof(t_matrix), 0, A_GIMME, 0);
- class_addbang (mtx_element_class, matrix_bang);
- class_addfloat (mtx_element_class, mtx_element_float);
- class_addmethod(mtx_element_class, (t_method)mtx_element_matrix, gensym("matrix"), A_GIMME, 0);
- class_addmethod(mtx_element_class, (t_method)mtx_element_list2, gensym(""), A_FLOAT, A_FLOAT, 0);
- class_sethelpsymbol(mtx_element_class, gensym("zexy/mtx_element"));
-}
-
-/* mtx_eye */
-static t_class *mtx_eye_class;
-static void *mtx_eye_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_matrix *x = (t_matrix *)pd_new(mtx_eye_class);
- int col=0, row=0;
- outlet_new(&x->x_obj, 0);
- x->row = x->col = 0;
- x->atombuffer = 0;
- switch(argc) {
- case 0:
- break;
- case 1:
- col=row=atom_getfloat(argv);
- break;
- default:
- row=atom_getfloat(argv++);
- col=atom_getfloat(argv);
- }
- if(col<0)col=0;
- if(row<0)row=0;
- if (col*row){
- int n = (col<row)?col:row;
- x->atombuffer = (t_atom *)getbytes((col*row+2)*sizeof(t_atom));
- setdimen(x, row, col);
- matrix_set(x, 0);
- while(n--)SETFLOAT(x->atombuffer+2+n*(1+col), 1);
- }
- return (x);
-}
-static void mtx_eye_setup(void)
-{
- mtx_eye_class = class_new(gensym("mtx_eye"), (t_newmethod)mtx_eye_new,
- (t_method)matrix_free, sizeof(t_matrix), 0, A_GIMME, 0);
- class_addlist(mtx_eye_class, matrix_eye);
- class_addbang(mtx_eye_class, matrix_bang);
- class_addmethod(mtx_eye_class, (t_method)matrix_eye, gensym("matrix"), A_GIMME, 0);
-
- class_sethelpsymbol(mtx_eye_class, gensym("zexy/mtx_special"));
-}
-/* mtx_egg */
-static t_class *mtx_egg_class;
-static void *mtx_egg_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_matrix *x = (t_matrix *)pd_new(mtx_egg_class);
- int col=0, row=0;
- outlet_new(&x->x_obj, 0);
- x->row = x->col = 0;
- x->atombuffer = 0;
- switch(argc) {
- case 0:
- break;
- case 1:
- col=row=atom_getfloat(argv);
- break;
- default:
- row=atom_getfloat(argv++);
- col=atom_getfloat(argv);
- }
- if(col<0)col=0;
- if(row<0)row=0;
- if (col*row){
- int n = (col<row)?col:row;
- x->atombuffer = (t_atom *)getbytes((col*row+2)*sizeof(t_atom));
- setdimen(x, row, col);
- matrix_set(x, 0);
- while(n--)SETFLOAT(x->atombuffer+2+(n+1)*(col-1), 1);
- }
- return (x);
-}
-static void mtx_egg_setup(void)
-{
- mtx_egg_class = class_new(gensym("mtx_egg"), (t_newmethod)mtx_egg_new,
- (t_method)matrix_free, sizeof(t_matrix), 0, A_GIMME, 0);
- class_addlist(mtx_egg_class, matrix_egg);
- class_addbang(mtx_egg_class, matrix_bang);
- class_addmethod(mtx_egg_class, (t_method)matrix_egg, gensym("matrix"), A_GIMME, 0);
-
- class_sethelpsymbol(mtx_egg_class, gensym("zexy/mtx_special"));
-}
-/* mtx_ones */
-static t_class *mtx_ones_class;
-static void *mtx_ones_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_matrix *x = (t_matrix *)pd_new(mtx_ones_class);
- int col=0, row=0;
- outlet_new(&x->x_obj, 0);
- x->row = x->col = 0;
- x->atombuffer = 0;
- switch(argc) {
- case 0:
- break;
- case 1:
- col=row=atom_getfloat(argv);
- break;
- default:
- row=atom_getfloat(argv++);
- col=atom_getfloat(argv);
- }
- if(col<0)col=0;
- if(row<0)row=0;
- if (col*row){
- x->atombuffer = (t_atom *)getbytes((col*row+2)*sizeof(t_atom));
- setdimen(x, row, col);
- matrix_set(x, 1);
- }
- return (x);
-}
-static void mtx_ones_setup(void)
-{
- mtx_ones_class = class_new(gensym("mtx_ones"), (t_newmethod)mtx_ones_new,
- (t_method)matrix_free, sizeof(t_matrix), 0, A_GIMME, 0);
- class_addlist(mtx_ones_class, matrix_ones);
- class_addbang(mtx_ones_class, matrix_bang);
- class_addmethod(mtx_ones_class, (t_method)matrix_ones, gensym("matrix"), A_GIMME, 0);
-
- class_sethelpsymbol(mtx_ones_class, gensym("zexy/mtx_special"));
-}
-
-/* mtx_zeros */
-static t_class *mtx_zeros_class;
-static void *mtx_zeros_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_matrix *x = (t_matrix *)pd_new(mtx_zeros_class);
- int col=0, row=0;
- outlet_new(&x->x_obj, 0);
- x->row = x->col = 0;
- x->atombuffer = 0;
- switch(argc) {
- case 0:
- break;
- case 1:
- col=row=atom_getfloat(argv);
- break;
- default:
- row=atom_getfloat(argv++);
- col=atom_getfloat(argv);
- }
- if(col<0)col=0;
- if(row<0)row=0;
- if (col*row){
- x->atombuffer = (t_atom *)getbytes((col*row+2)*sizeof(t_atom));
- setdimen(x, row, col);
- matrix_set(x, 0);
- }
- return (x);
-}
-static void mtx_zeros_setup(void)
-{
- mtx_zeros_class = class_new(gensym("mtx_zeros"), (t_newmethod)mtx_zeros_new,
- (t_method)matrix_free, sizeof(t_matrix), 0, A_GIMME, 0);
- class_addlist(mtx_zeros_class, matrix_zeros);
- class_addbang(mtx_zeros_class, matrix_bang);
- class_addmethod(mtx_zeros_class, (t_method)matrix_zeros, gensym("matrix"), A_GIMME, 0);
-
- class_sethelpsymbol(mtx_zeros_class, gensym("zexy/mtx_special"));
-}
-
-/* mtx_diag */
-static t_class *mtx_diag_class;
-static void mtx_diag_matrix(t_matrix *x, t_symbol *s, int argc, t_atom *argv)
-{
- int row=atom_getfloat(argv++);
- int col=atom_getfloat(argv++);
- int length=(col<row)?col:row, n=length;
- t_atom *ap = (t_atom *)getbytes(length * sizeof(t_atom)), *dummy=ap;
- if(row*col>argc-2)post("mtx_diag: sparse matrices not yet supported : use \"mtx_check\"");
- else {
- for(n=0;n<length;n++, dummy++)SETFLOAT(dummy, atom_getfloat(argv+n*(col+1)));
- outlet_list(x->x_obj.ob_outlet, gensym("diag"), length, ap);
- }
- freebytes(ap, (length * sizeof(t_atom)));
-}
-
-static void *mtx_diag_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_matrix *x = (t_matrix *)pd_new(mtx_diag_class);
- outlet_new(&x->x_obj, 0);
- x->row = x->col = 0;
- x->atombuffer = 0;
-
- if(!argc)return(x);
- x->atombuffer = (t_atom *)getbytes((argc*argc+2)*sizeof(t_atom));
- setdimen(x, argc, argc);
- matrix_set(x, 0);
- argv+=argc-1;
- while(argc--)SETFLOAT(x->atombuffer+2+argc*(1+x->col), atom_getfloat(argv--));
-
- return (x);
-}
-static void mtx_diag_setup(void)
-{
- mtx_diag_class = class_new(gensym("mtx_diag"), (t_newmethod)mtx_diag_new,
- (t_method)matrix_free, sizeof(t_matrix), 0, A_GIMME, 0);
- class_addlist (mtx_diag_class, matrix_diag);
- class_addbang (mtx_diag_class, matrix_bang);
- class_addmethod(mtx_diag_class, (t_method)mtx_diag_matrix, gensym("matrix"), A_GIMME, 0);
- class_sethelpsymbol(mtx_diag_class, gensym("zexy/mtx_trace"));
-}
-
-/* mtx_diegg */
-static t_class *mtx_diegg_class;
-static void mtx_diegg_matrix(t_matrix *x, t_symbol *s, int argc, t_atom *argv)
-{
- int row=atom_getfloat(argv++);
- int col=atom_getfloat(argv++);
- int length=(col<row)?col:row, n=length;
- t_atom *ap = (t_atom *)getbytes(length * sizeof(t_atom)), *dummy=ap;
- if(row*col>argc-2)post("mtx_diegg: sparse matrices not yet supported : use \"mtx_check\"");
- else {
- for(n=0;n<length;n++, dummy++)SETFLOAT(dummy, atom_getfloat(argv+(n-1)*(col-1)));
- outlet_list(x->x_obj.ob_outlet, gensym("diegg"), length, ap);
- }
- freebytes(ap, (length * sizeof(t_atom)));
-}
-
-static void *mtx_diegg_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_matrix *x = (t_matrix *)pd_new(mtx_diegg_class);
- outlet_new(&x->x_obj, 0);
- x->row = x->col = 0;
- x->atombuffer = 0;
-
- if(!argc)return(x);
- x->atombuffer = (t_atom *)getbytes((argc*argc+2)*sizeof(t_atom));
- setdimen(x, argc, argc);
- matrix_set(x, 0);
- argv+=argc-1;
- while(argc--)SETFLOAT(x->atombuffer+2+argc*(1+x->col), atom_getfloat(argv--));
-
- return (x);
-}
-static void mtx_diegg_setup(void)
-{
- mtx_diegg_class = class_new(gensym("mtx_diegg"), (t_newmethod)mtx_diegg_new,
- (t_method)matrix_free, sizeof(t_matrix), 0, A_GIMME, 0);
- class_addlist (mtx_diegg_class, matrix_diegg);
- class_addbang (mtx_diegg_class, matrix_bang);
- class_addmethod(mtx_diegg_class, (t_method)mtx_diegg_matrix, gensym("matrix"), A_GIMME, 0);
- class_sethelpsymbol(mtx_diegg_class, gensym("zexy/mtx_special"));
-}
-/* mtx_trace */
-static t_class *mtx_trace_class;
-typedef struct _mtx_trace
-{
- t_object x_obj;
- t_float trace;
-} t_mtx_trace;
-static void mtx_trace_bang(t_mtx_trace *x)
-{
- outlet_float(x->x_obj.ob_outlet, x->trace);
-}
-static void mtx_trace_matrix(t_mtx_trace *x, t_symbol *s, int argc, t_atom *argv)
-{
- int row=atom_getfloat(argv++);
- int col=atom_getfloat(argv++);
- int length=(col<row)?col:row;
- t_float trace = 0;
- if(row*col>argc-2)post("mtx_trace: sparse matrices not yet supported : use \"mtx_check\"");
- else while(length--)trace+=atom_getfloat(argv+length*(col+1));
- x->trace=trace;
- mtx_trace_bang(x);
-}
-static void *mtx_trace_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_mtx_trace *x = (t_mtx_trace *)pd_new(mtx_trace_class);
- outlet_new(&x->x_obj, 0);
- x->trace=0;
- return (x);
-}
-static void mtx_trace_setup(void)
-{
- mtx_trace_class = class_new(gensym("mtx_trace"), (t_newmethod)mtx_trace_new,
- 0, sizeof(t_mtx_trace), 0, A_GIMME, 0);
- class_addbang (mtx_trace_class, mtx_trace_bang);
- class_addmethod(mtx_trace_class, (t_method)mtx_trace_matrix, gensym("matrix"), A_GIMME, 0);
- class_sethelpsymbol(mtx_trace_class, gensym("zexy/mtx_trace"));
-}
-
-/* mtx_mean */
-static t_class *mtx_mean_class;
-
-static void mtx_mean_matrix(t_matrix *x, t_symbol *s, int argc, t_atom *argv)
-{
- int row=atom_getfloat(argv++);
- int col=atom_getfloat(argv++);
- t_atom *ip, *op;
- int c=col, r;
- t_float sum;
- t_float factor=1./row;
- adjustsize(x, 1, col);
- op=x->atombuffer;
-
- while(c--){
- sum=0;
- ip=argv+col-c-1;
- r=row;
- while(r--)sum+=atom_getfloat(ip+col*r);
- SETFLOAT(op, sum*factor);
- op++;
- }
- outlet_list(x->x_obj.ob_outlet, gensym("row"), col, x->atombuffer);
-}
-
-static void *mtx_mean_new(void)
-{
- t_matrix *x = (t_matrix *)pd_new(mtx_mean_class);
- outlet_new(&x->x_obj, 0);
- x->col=x->row=0;
- x->atombuffer=0;
- return (x);
-}
-static void mtx_mean_setup(void)
-{
- mtx_mean_class = class_new(gensym("mtx_mean"), (t_newmethod)mtx_mean_new,
- (t_method)matrix_free, sizeof(t_matrix), 0, 0, 0);
- class_addmethod(mtx_mean_class, (t_method)mtx_mean_matrix, gensym("matrix"), A_GIMME, 0);
- class_sethelpsymbol(mtx_mean_class, gensym("zexy/mtx_mean"));
-}
-
-/* mtx_rand */
-static t_class *mtx_rand_class;
-
-static void mtx_rand_seed(t_matrix *x, t_float f)
-{
- x->current_row=f;
-}
-static int makeseed(void)
-{
- static unsigned int random_nextseed = 1489853723;
- random_nextseed = random_nextseed * 435898247 + 938284287;
- return (random_nextseed & 0x7fffffff);
-}
-static void mtx_rand_random(t_matrix *x)
-{
- long size = x->row * x->col;
- t_atom *ap=x->atombuffer+2;
- int val = x->current_row;
- while(size--)SETFLOAT(ap+size, ((float)(((val=val*435898247+382842987)&0x7fffffff)-0x40000000))*(float)(0.5/0x40000000)+0.5);
- x->current_row=val;
-}
-
-static void mtx_rand_list(t_matrix *x, t_symbol *s, int argc, t_atom *argv)
-{
- int row = atom_getfloat(argv++);
- int col = atom_getfloat(argv++);
-
- if(!argv)return;
- if(argc==1)col=row;
-
- adjustsize(x, row, col);
- mtx_rand_random(x);
- matrix_bang(x);
-}
-static void mtx_rand_matrix(t_matrix *x, t_symbol *s, int argc, t_atom *argv)
-{
- matrix_matrix2(x, s, argc, argv);
- mtx_rand_random(x);
- matrix_bang(x);
-}
-static void mtx_rand_bang(t_matrix *x)
-{
- mtx_rand_random(x);
- matrix_bang(x);
-}
-static void *mtx_rand_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_matrix *x = (t_matrix *)pd_new(mtx_rand_class);
- int row, col;
- outlet_new(&x->x_obj, 0);
- x->col=x->row=0;
- x->atombuffer=0;
- x->current_row=makeseed();
-
- if (argc) {
- row=atom_getfloat(argv);
- col=(argc>1)?atom_getfloat(argv+1):row;
- adjustsize(x, row, col);
- mtx_rand_random(x);
- }
- return (x);
-}
-static void mtx_rand_setup(void)
-{
- mtx_rand_class = class_new(gensym("mtx_rand"), (t_newmethod)mtx_rand_new,
- (t_method)matrix_free, sizeof(t_matrix), 0, A_GIMME, 0);
- class_addmethod(mtx_rand_class, (t_method)mtx_rand_matrix, gensym("matrix"), A_GIMME, 0);
- class_addlist (mtx_rand_class, mtx_rand_list);
- class_addbang (mtx_rand_class, mtx_rand_bang);
-
- class_addmethod(mtx_rand_class, (t_method)mtx_rand_seed, gensym("seed"), A_FLOAT, 0);
- class_sethelpsymbol(mtx_rand_class, gensym("zexy/mtx_rand"));
-}
-
-
-/* mtx_scroll */
-/* scroll the rows */
-static t_class *mtx_scroll_class;
-
-static void mtx_scroll_matrix(t_matrix *x, t_symbol *s, int argc, t_atom *argv)
-{
- int row=atom_getfloat(argv++);
- int col=atom_getfloat(argv++);
- int rowscroll = ((int)x->f%row+row)%row;
-
- if(row*col>argc-2) {
- post("mtx_scroll: sparse matrices not yet supported : use \"mtx_check\"");
- return;
- }
- adjustsize(x, row, col);
-
- memcpy(x->atombuffer+2, argv+(row-rowscroll)*col, rowscroll*col*sizeof(t_atom));
- memcpy(x->atombuffer+2+rowscroll*col, argv, (row-rowscroll)*col*sizeof(t_atom));
-
- matrix_bang(x);
-}
-
-static void *mtx_scroll_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_matrix *x = (t_matrix *)pd_new(mtx_scroll_class);
- floatinlet_new(&x->x_obj, &(x->f));
- outlet_new(&x->x_obj, 0);
-
- x->f=argc?atom_getfloat(argv):0;
- x->col=x->row=0;
- x->atombuffer=0;
- return (x);
-}
-static void mtx_scroll_setup(void)
-{
- mtx_scroll_class = class_new(gensym("mtx_scroll"), (t_newmethod)mtx_scroll_new,
- (t_method)matrix_free, sizeof(t_matrix), 0, A_GIMME, 0);
- class_addbang (mtx_scroll_class, matrix_bang);
- class_addmethod(mtx_scroll_class, (t_method)mtx_scroll_matrix, gensym("matrix"), A_GIMME, 0);
- class_sethelpsymbol(mtx_scroll_class, gensym("zexy/mtx_transpose"));
-}
-
-/* mtx_roll */
-/* roll the rows */
-static t_class *mtx_roll_class;
-
-static void mtx_roll_matrix(t_matrix *x, t_symbol *s, int argc, t_atom *argv)
-{
- int row=atom_getfloat(argv++);
- int col=atom_getfloat(argv++);
- t_atom *ap;
- int colroll = ((int)x->f%col+col)%col;
- int c;
-
- if(row*col>argc-2) {
- post("mtx_roll: sparse matrices not yet supported : use \"mtx_check\"");
- return;
- }
-
- adjustsize(x, row, col);
- ap = x->atombuffer+2;
-
- c=col;
- while(c--){
- t_atom *in = argv+col-c-1;
- t_atom *out = ap +(col-c-1+colroll)%col;
- int r = row;
- while (r--){
- SETFLOAT(out, atom_getfloat(in));
- out+=col;
- in+=col;
- }
-
- }
-
- matrix_bang(x);
-}
-
-static void *mtx_roll_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_matrix *x = (t_matrix *)pd_new(mtx_roll_class);
- floatinlet_new(&x->x_obj, &(x->f));
- outlet_new(&x->x_obj, 0);
-
- x->f=argc?atom_getfloat(argv):0;
- x->col=x->row=0;
- x->atombuffer=0;
- return (x);
-}
-static void mtx_roll_setup(void)
-{
- mtx_roll_class = class_new(gensym("mtx_roll"), (t_newmethod)mtx_roll_new,
- (t_method)matrix_free, sizeof(t_matrix), 0, A_GIMME, 0);
- class_addbang (mtx_roll_class, matrix_bang);
- class_addmethod(mtx_roll_class, (t_method)mtx_roll_matrix, gensym("matrix"), A_GIMME, 0);
- class_sethelpsymbol(mtx_roll_class, gensym("zexy/mtx_transpose"));
-}
-
-/* mtx_transpose */
-static t_class *mtx_transpose_class;
-
-static void mtx_transpose_matrix(t_matrix *x, t_symbol *s, int argc, t_atom *argv)
-{
- int row=atom_getfloat(argv++);
- int col=atom_getfloat(argv++);
- t_atom *ap;
- int r, c;
-
- if(row*col>argc-2) {
- post("mtx_transpose: sparse matrices not yet supported : use \"mtx_check\"");
- return;
- }
- if (col*row!=x->col*x->row) {
- freebytes(x->atombuffer, (x->col*x->row+2)*sizeof(t_atom));
- x->atombuffer = (t_atom *)getbytes((row*col+2)*sizeof(t_atom));
- }
- ap = x->atombuffer+2;
- setdimen(x, col, row);
- r = row;
- while(r--){
- c=col;
- while(c--) {
- t_float f = atom_getfloat(argv+r*col+c);
- SETFLOAT(ap+c*row+r, f);
- }
- }
-
- matrix_bang(x);
-}
-
-static void *mtx_transpose_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_matrix *x = (t_matrix *)pd_new(mtx_transpose_class);
- outlet_new(&x->x_obj, 0);
- x->col=x->row=0;
- x->atombuffer=0;
- return (x);
-}
-static void mtx_transpose_setup(void)
-{
- mtx_transpose_class = class_new(gensym("mtx_transpose"), (t_newmethod)mtx_transpose_new,
- (t_method)matrix_free, sizeof(t_matrix), 0, A_GIMME, 0);
- class_addbang (mtx_transpose_class, matrix_bang);
- class_addmethod(mtx_transpose_class, (t_method)mtx_transpose_matrix, gensym("matrix"), A_GIMME, 0);
- class_sethelpsymbol(mtx_transpose_class, gensym("zexy/mtx_transpose"));
-}
-
-/* -­------------------------------------------------------------- */
-/* matrix math */
-
-typedef struct _mtx_binscalar
-{
- t_object x_obj;
-
- t_matrix m; // the output matrix
- t_float f; // the second input
-} t_mtx_binscalar;
-
-typedef struct _mtx_binmtx
-{
- t_object x_obj;
-
- t_matrix m; // the output matrix
- t_matrix m2; // the second input
-} t_mtx_binmtx;
-
-static void mtx_bin_matrix2(t_mtx_binmtx *x, t_symbol *s, int argc, t_atom *argv)
-{
- int row = atom_getfloat(argv);
- int col = atom_getfloat(argv+1);
- if (argc<2){post("mtx_bin2: crippled matrix"); return;}
- if ((col<1)||(row<1)) {post("mtx_bin2: invalid dimensions %dx%d", row,col); return;}
- if (col*row+2>argc){ post("mtx_bin2: sparse matrix not yet supported : use \"mtx_check\""); return;}
-
- if (row*col!=x->m2.row*x->m2.col) {
- freebytes(x->m2.atombuffer, (x->m2.row*x->m2.col+2)*sizeof(t_atom));
- x->m2.atombuffer=copybytes(argv,(row*col+2)*sizeof(t_atom));
- }else memcpy(x->m2.atombuffer, argv, (row*col+2)*sizeof(t_atom));
- setdimen(&x->m2, row, col);
-}
-
-static void mtx_binmtx_bang(t_mtx_binmtx *x)
-{
- if((&x->m)&&(x->m.atombuffer))
- outlet_anything(x->x_obj.ob_outlet, gensym("matrix"), x->m.col*x->m.row+2, x->m.atombuffer);
-}
-
-
-static void mtx_binmtx_free(t_mtx_binmtx *x)
-{
- matrix_free(&x->m);
- matrix_free(&x->m2);
-}
-static void mtx_binscalar_bang(t_mtx_binscalar *x)
-{
- if((&x->m)&&(x->m.atombuffer))
- outlet_anything(x->x_obj.ob_outlet, gensym("matrix"), x->m.col*x->m.row+2, x->m.atombuffer);
-}
-static void mtx_binscalar_free(t_mtx_binscalar *x)
-{
- matrix_free(&x->m);
-}
-
-
-
-/* mtx_add */
-static t_class *mtx_add_class, *mtx_addscalar_class;
-
-static void mtx_addscalar_matrix(t_mtx_binscalar *x, t_symbol *s, int argc, t_atom *argv)
-{
- int n=argc-2;
- int row=atom_getfloat(argv), col=atom_getfloat(argv+1);
-
- t_float offset=x->f;
- t_atom *buf;
- t_atom *ap=argv+2;
-
- if(argc<2){post("mtx_add: crippled matrix");return; }
- adjustsize(&x->m, row, col);
-
- buf=x->m.atombuffer+2;
-
- while(n--){
- buf->a_type = A_FLOAT;
- buf++->a_w.w_float = atom_getfloat(ap++) + offset;
- }
- outlet_anything(x->x_obj.ob_outlet, gensym("matrix"), argc, x->m.atombuffer);
-}
-static void mtx_addscalar_list(t_mtx_binscalar *x, t_symbol *s, int argc, t_atom *argv)
-{
- int n=argc;
- t_atom *m;
- t_float offset = x->f;
- adjustsize(&x->m, 1, argc);
- m = x->m.atombuffer;
-
- while(n--){
- m->a_type = A_FLOAT;
- (m++)->a_w.w_float = atom_getfloat(argv++) + offset;
- }
- outlet_list(x->x_obj.ob_outlet, gensym("list"), argc, x->m.atombuffer);
-}
-
-static void mtx_add_matrix(t_mtx_binmtx *x, t_symbol *s, int argc, t_atom *argv)
-{
- int row=atom_getfloat(argv);
- int col=atom_getfloat(argv+1);
- t_atom *m;
- t_atom *m1 = argv+2;
- t_atom *m2 = x->m2.atombuffer+2;
- int n = argc-2;
-
- if (argc<2){ post("mtx_add: crippled matrix"); return; }
- if ((col<1)||(row<1)) { post("mtx_add: invalid dimensions"); return; }
- if (col*row>argc-2){ post("sparse matrix not yet supported : use \"mtx_check\""); return; }
-
- if (!(x->m2.col*x->m2.row)) {
- outlet_anything(x->x_obj.ob_outlet, gensym("matrix"), argc, argv);
- return;
- }
-
- if ((col!=x->m2.col)||(row!=x->m2.row)){
- post("mtx_add: matrix dimensions do not match");
- /* LATER SOLVE THIS */
- return;
- }
- adjustsize(&x->m, row, col);
- m = x->m.atombuffer+2;
-
- while(n--){
- t_float f = atom_getfloat(m1++)+atom_getfloat(m2++);
- SETFLOAT(m, f);
- m++;
- }
-
- outlet_anything(x->x_obj.ob_outlet, gensym("matrix"), argc, x->m.atombuffer);
-}
-static void mtx_add_float(t_mtx_binmtx *x, t_float f)
-{
- t_matrix *m=&x->m, *m2=&x->m2;
- t_atom *ap, *ap2=m2->atombuffer+2;
- int row2, col2, n;
-
- if (!m2->atombuffer){ post("mulitply with what ?"); return; }
-
- row2=atom_getfloat(m2->atombuffer);
- col2=atom_getfloat(m2->atombuffer+1);
- adjustsize(m, row2, col2);
- ap=m->atombuffer+2;
-
- n=row2*col2;
-
- while(n--){
- SETFLOAT(ap, f+atom_getfloat(ap2++));
- ap++;
- }
-
- outlet_anything(x->x_obj.ob_outlet, gensym("matrix"), m->row*m->col+2, m->atombuffer);
-}
-static void *mtx_add_new(t_symbol *s, int argc, t_atom *argv)
-{
- if (argc>1) post("mtx_add : extra arguments ignored");
- if (argc) {
- t_mtx_binscalar *x = (t_mtx_binscalar *)pd_new(mtx_addscalar_class);
- floatinlet_new(&x->x_obj, &x->f);
- x->f = atom_getfloatarg(0, argc, argv);
- outlet_new(&x->x_obj, 0);
- return(x);
- } else {
- t_mtx_binmtx *x = (t_mtx_binmtx *)pd_new(mtx_add_class);
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("matrix"), gensym(""));
- outlet_new(&x->x_obj, 0);
- x->m.col = x->m.row = x->m2.col = x->m2.row = 0;
- x->m.atombuffer = x->m2.atombuffer = 0;
- return(x);
- }
-}
-
-static void mtx_add_setup(void)
-{
- mtx_add_class = class_new(gensym("mtx_add"), (t_newmethod)mtx_add_new, (t_method)mtx_binmtx_free,
- sizeof(t_mtx_binmtx), 0, A_GIMME, 0);
- class_addcreator((t_newmethod)mtx_add_new, gensym("mtx_+"), A_GIMME,0);
- class_addmethod(mtx_add_class, (t_method)mtx_add_matrix, gensym("matrix"), A_GIMME, 0);
- class_addmethod(mtx_add_class, (t_method)mtx_bin_matrix2, gensym(""), A_GIMME, 0);
- class_addfloat (mtx_add_class, mtx_add_float);
- class_addbang (mtx_add_class, mtx_binmtx_bang);
-
- mtx_addscalar_class = class_new(gensym("mtx_add"), 0, (t_method)mtx_binscalar_free,
- sizeof(t_mtx_binscalar), 0, 0);
- class_addcreator(0, gensym("mtx_+"), 0, 0);
- class_addmethod(mtx_addscalar_class, (t_method)mtx_addscalar_matrix, gensym("matrix"), A_GIMME, 0);
- class_addlist (mtx_addscalar_class, mtx_addscalar_list);
- class_addbang (mtx_addscalar_class, mtx_binscalar_bang);
-
- class_sethelpsymbol(mtx_add_class, gensym("zexy/mtx_binops"));
- class_sethelpsymbol(mtx_addscalar_class, gensym("zexy/mtx_binops"));
-}
-
-/* mtx_sub */
-static t_class *mtx_sub_class, *mtx_subscalar_class;
-
-static void mtx_subscalar_matrix(t_mtx_binscalar *x, t_symbol *s, int argc, t_atom *argv)
-{
- int n=argc-2;
- int row=atom_getfloat(argv), col=atom_getfloat(argv+1);
-
- t_float offset=x->f;
- t_atom *buf;
- t_atom *ap=argv+2;
-
- if(argc<2){post("mtx_sub: crippled matrix");return; }
- adjustsize(&x->m, row, col);
-
- buf=x->m.atombuffer+2;
-
- while(n--){
- buf->a_type = A_FLOAT;
- buf++->a_w.w_float = atom_getfloat(ap++) - offset;
- }
- outlet_anything(x->x_obj.ob_outlet, gensym("matrix"), argc, x->m.atombuffer);
-}
-static void mtx_subscalar_list(t_mtx_binscalar *x, t_symbol *s, int argc, t_atom *argv)
-{
- int n=argc;
- t_atom *m;
- t_float offset = x->f;
- adjustsize(&x->m, 1, argc);
- m = x->m.atombuffer;
-
- while(n--){
- m->a_type = A_FLOAT;
- (m++)->a_w.w_float = atom_getfloat(argv++) - offset;
- }
- outlet_list(x->x_obj.ob_outlet, gensym("list"), argc, x->m.atombuffer);
-}
-
-static void mtx_sub_matrix(t_mtx_binmtx *x, t_symbol *s, int argc, t_atom *argv)
-{
- int row=atom_getfloat(argv);
- int col=atom_getfloat(argv+1);
- t_atom *m;
- t_atom *m1 = argv+2;
- t_atom *m2 = x->m2.atombuffer+2;
- int n = argc-2;
-
- if (argc<2){ post("mtx_sub: crippled matrix"); return; }
- if ((col<1)||(row<1)) { post("mtx_sub: invalid dimensions"); return; }
- if (col*row>argc-2){ post("sparse matrix not yet supported : use \"mtx_check\""); return; }
-
- if (!(x->m2.col*x->m2.row)) {
- outlet_anything(x->x_obj.ob_outlet, gensym("matrix"), argc, argv);
- return;
- }
-
- if ((col!=x->m2.col)||(row!=x->m2.row)){
- post("mtx_sub: matrix dimensions do not match");
- /* LATER SOLVE THIS */
- return;
- }
- adjustsize(&x->m, row, col);
- m = x->m.atombuffer+2;
-
- while(n--){
- t_float f = atom_getfloat(m1++)-atom_getfloat(m2++);
- SETFLOAT(m, f);
- m++;
- }
-
- outlet_anything(x->x_obj.ob_outlet, gensym("matrix"), argc, x->m.atombuffer);
-}
-static void mtx_sub_float(t_mtx_binmtx *x, t_float f)
-{
- t_matrix *m=&x->m, *m2=&x->m2;
- t_atom *ap, *ap2=m2->atombuffer+2;
- int row2, col2, n;
-
- if (!m2->atombuffer){ post("mulitply with what ?"); return; }
-
- row2=atom_getfloat(m2->atombuffer);
- col2=atom_getfloat(m2->atombuffer+1);
- adjustsize(m, row2, col2);
- ap=m->atombuffer+2;
-
- n=row2*col2;
-
- while(n--){
- SETFLOAT(ap, f-atom_getfloat(ap2++));
- ap++;
- }
-
- outlet_anything(x->x_obj.ob_outlet, gensym("matrix"), m->row*m->col+2, m->atombuffer);
-}
-static void *mtx_sub_new(t_symbol *s, int argc, t_atom *argv)
-{
- if (argc>1) post("mtx_sub : extra arguments ignored");
- if (argc) {
- t_mtx_binscalar *x = (t_mtx_binscalar *)pd_new(mtx_subscalar_class);
- floatinlet_new(&x->x_obj, &x->f);
- x->f = atom_getfloatarg(0, argc, argv);
- outlet_new(&x->x_obj, 0);
- return(x);
- } else {
- t_mtx_binmtx *x = (t_mtx_binmtx *)pd_new(mtx_sub_class);
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("matrix"), gensym(""));
- outlet_new(&x->x_obj, 0);
- x->m.col = x->m.row = x->m2.col = x->m2.row = 0;
- x->m.atombuffer = x->m2.atombuffer = 0;
- return(x);
- }
-}
-
-static void mtx_sub_setup(void)
-{
- mtx_sub_class = class_new(gensym("mtx_sub"), (t_newmethod)mtx_sub_new, (t_method)mtx_binmtx_free,
- sizeof(t_mtx_binmtx), 0, A_GIMME, 0);
- class_addcreator((t_newmethod)mtx_sub_new, gensym("mtx_-"), A_GIMME,0);
- class_addmethod(mtx_sub_class, (t_method)mtx_sub_matrix, gensym("matrix"), A_GIMME, 0);
- class_addmethod(mtx_sub_class, (t_method)mtx_bin_matrix2, gensym(""), A_GIMME, 0);
- class_addfloat (mtx_sub_class, mtx_sub_float);
- class_addbang (mtx_sub_class, mtx_binmtx_bang);
-
- mtx_subscalar_class = class_new(gensym("mtx_sub"), 0, (t_method)mtx_binscalar_free,
- sizeof(t_mtx_binscalar), 0, 0);
- class_addcreator(0, gensym("mtx_-"), 0, 0);
- class_addmethod(mtx_subscalar_class, (t_method)mtx_subscalar_matrix, gensym("matrix"), A_GIMME, 0);
- class_addlist (mtx_subscalar_class, mtx_subscalar_list);
- class_addbang (mtx_subscalar_class, mtx_binscalar_bang);
-
- class_sethelpsymbol(mtx_sub_class, gensym("zexy/mtx_binops"));
- class_sethelpsymbol(mtx_subscalar_class, gensym("zexy/mtx_binops"));
-}
-
-
-/* mtx_mul */
-static t_class *mtx_mul_class, *mtx_mulelement_class, *mtx_mulscalar_class;
-
-static void mtx_mul_matrix(t_mtx_binmtx *x, t_symbol *s, int argc, t_atom *argv)
-{
- t_matrix *m=&x->m, *m2=&x->m2;
- t_atom *ap, *ap1=argv+2, *ap2=m2->atombuffer+2;
- int row=atom_getfloat(argv), col=atom_getfloat(argv+1);
- int row2, col2, n, r, c;
-
- if (!m2->atombuffer){ post("mulitply with what ?"); return; }
- if (argc<2){ post("mtx_mul: crippled matrix"); return; }
- if ((col<1)||(row<1)){post("mtx_mul: invalid dimensions"); return; }
- if (col*row>argc-2){ post("sparse matrix not yet supported : use \"mtx_check\""); return; }
-
- row2=atom_getfloat(m2->atombuffer);
- col2=atom_getfloat(m2->atombuffer+1);
-
- if (col!=row2) { post("mtx_mul: matrix dimensions do not match !"); return; }
-
- adjustsize(m, row, col2);
- ap=m->atombuffer+2;
-
- for(r=0;r<row;r++)
- for(c=0;c<col2;c++) {
- T_FLOAT sum = 0.f;
- for(n=0;n<col;n++)sum+=(T_FLOAT)atom_getfloat(ap1+col*r+n)*atom_getfloat(ap2+col2*n+c);
- SETFLOAT(ap+col2*r+c,sum);
- }
- outlet_anything(x->x_obj.ob_outlet, gensym("matrix"), m->row*m->col+2, m->atombuffer);
-}
-
-static void mtx_mul_float(t_mtx_binmtx *x, t_float f)
-{
- t_matrix *m=&x->m, *m2=&x->m2;
- t_atom *ap, *ap2=m2->atombuffer+2;
- int row2, col2, n;
-
- if (!m2->atombuffer){ post("mulitply with what ?"); return; }
-
- row2=atom_getfloat(m2->atombuffer);
- col2=atom_getfloat(m2->atombuffer+1);
- adjustsize(m, row2, col2);
- ap=m->atombuffer+2;
-
- n=row2*col2;
-
- while(n--){
- SETFLOAT(ap, f*atom_getfloat(ap2++));
- ap++;
- }
-
- outlet_anything(x->x_obj.ob_outlet, gensym("matrix"), m->row*m->col+2, m->atombuffer);
-}
-
-static void mtx_mulelement_matrix(t_mtx_binmtx *x, t_symbol *s, int argc, t_atom *argv)
-{
- int row=atom_getfloat(argv++);
- int col=atom_getfloat(argv++);
- t_atom *m;
- t_atom *m2 = x->m2.atombuffer+2;
- int n = argc-2;
-
- if (argc<2){ post("mtx_mul: crippled matrix"); return; }
- if ((col<1)||(row<1)) { post("mtx_mul: invalid dimensions"); return; }
- if (col*row>argc-2){ post("sparse matrix not yet supported : use \"mtx_check\""); return; }
- if (!(x->m2.col*x->m2.row)) {
- adjustsize(&x->m, row, col);
- matrix_set(&x->m, 0);
- outlet_anything(x->x_obj.ob_outlet, gensym("matrix"), argc, x->m.atombuffer);
- return;
- }
- if ((col!=x->m2.col)||(row!=x->m2.row)){ post("matrix dimension do not match"); /* LATER SOLVE THIS */ return; }
-
- adjustsize(&x->m, row, col);
- m = x->m.atombuffer+2;
-
- while(n--){
- t_float f = atom_getfloat(argv++)*atom_getfloat(m2++);
- SETFLOAT(m, f);
- m++;
- }
-
- outlet_anything(x->x_obj.ob_outlet, gensym("matrix"), argc, x->m.atombuffer);
-}
-
-static void mtx_mulscalar_matrix(t_mtx_binscalar *x, t_symbol *s, int argc, t_atom *argv)
-{
- int n=argc-2;
- t_atom *m;
- t_float factor = x->f;
- int row=atom_getfloat(argv++);
- int col=atom_getfloat(argv++);
-
- if (argc<2){
- post("mtx_mul: crippled matrix");
- return;
- }
- adjustsize(&x->m, row, col);
- m = x->m.atombuffer+2;
-
- while(n--){
- m->a_type = A_FLOAT;
- (m++)->a_w.w_float = atom_getfloat(argv++)*factor;
- }
-
- outlet_anything(x->x_obj.ob_outlet, gensym("matrix"), argc, x->m.atombuffer);
-}
-static void mtx_mulscalar_list(t_mtx_binscalar *x, t_symbol *s, int argc, t_atom *argv)
-{
- int n=argc;
- t_atom *m;
- t_float factor = x->f;
- adjustsize(&x->m, 1, argc);
- m = x->m.atombuffer;
-
- while(n--){
- m->a_type = A_FLOAT;
- (m++)->a_w.w_float = atom_getfloat(argv++)*factor;
- }
- outlet_list(x->x_obj.ob_outlet, gensym("list"), argc, x->m.atombuffer);
-}
-
-static void *mtx_mul_new(t_symbol *s, int argc, t_atom *argv)
-{
- if (argc>1) post("mtx_mul : extra arguments ignored");
- if (argc) {
- t_mtx_binscalar *x = (t_mtx_binscalar *)pd_new(mtx_mulscalar_class);
- floatinlet_new(&x->x_obj, &x->f);
- x->f = atom_getfloatarg(0, argc, argv);
- outlet_new(&x->x_obj, 0);
- return(x);
- } else {
- if (s->s_name[4]=='.') {
- /* element mul */
-
- t_matrix *x = (t_matrix *)pd_new(mtx_mulelement_class);
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("matrix"), gensym(""));
- outlet_new(&x->x_obj, 0);
- x->col = x->row = 0;
- x->atombuffer = 0;
- return(x);
- } else {
- t_mtx_binmtx *x = (t_mtx_binmtx *)pd_new(mtx_mul_class);
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("matrix"), gensym(""));
- outlet_new(&x->x_obj, 0);
- x->m.col = x->m.row = x->m2.col = x->m2.row = 0;
- x->m.atombuffer = x->m2.atombuffer = 0;
- return (x);
- }
- }
-}
-
-static void mtx_mul_setup(void)
-{
- mtx_mul_class = class_new(gensym("mtx_mul"), (t_newmethod)mtx_mul_new, (t_method)mtx_binmtx_free,
- sizeof(t_mtx_binmtx), 0, A_GIMME, 0);
- class_addcreator((t_newmethod)mtx_mul_new, gensym("mtx_*"), A_GIMME,0);
- class_addmethod(mtx_mul_class, (t_method)mtx_mul_matrix, gensym("matrix"), A_GIMME, 0);
- class_addmethod(mtx_mul_class, (t_method)mtx_bin_matrix2, gensym(""), A_GIMME, 0);
- class_addfloat (mtx_mul_class, mtx_mul_float);
- class_addbang (mtx_mul_class, mtx_binmtx_bang);
-
- mtx_mulelement_class = class_new(gensym("mtx_.*"), (t_newmethod)mtx_mul_new, (t_method)mtx_binmtx_free,
- sizeof(t_mtx_binmtx), 0, A_GIMME, 0);
- class_addmethod(mtx_mulelement_class, (t_method)mtx_mulelement_matrix, gensym("matrix"), A_GIMME, 0);
- class_addmethod(mtx_mulelement_class, (t_method)mtx_bin_matrix2, gensym(""), A_GIMME, 0);
- class_addfloat (mtx_mulelement_class, mtx_mul_float);
- class_addbang (mtx_mulelement_class, mtx_binmtx_bang);
-
- mtx_mulscalar_class = class_new(gensym("mtx_mul"), 0, (t_method)mtx_binscalar_free,
- sizeof(t_mtx_binscalar), 0, 0);
- class_addcreator(0, gensym("mtx_*"), 0, 0);
- class_addcreator(0, gensym("mtx_.*"), 0, 0);
- class_addmethod(mtx_mulscalar_class, (t_method)mtx_mulscalar_matrix, gensym("matrix"), A_GIMME, 0);
- class_addlist (mtx_mulscalar_class, mtx_mulscalar_list);
- class_addbang (mtx_mulscalar_class, mtx_binscalar_bang);
-
- class_sethelpsymbol(mtx_mul_class, gensym("zexy/mtx_binops"));
- class_sethelpsymbol(mtx_mulelement_class, gensym("zexy/mtx_binops"));
- class_sethelpsymbol(mtx_mulscalar_class, gensym("zexy/mtx_binops"));
-}
-
-
-/* mtx_div */
-static t_class *mtx_divelement_class, *mtx_divscalar_class;
-
-static void mtx_divelement_matrix(t_mtx_binmtx *x, t_symbol *s, int argc, t_atom *argv)
-{
- int row=atom_getfloat(argv++);
- int col=atom_getfloat(argv++);
- t_atom *m;
- t_atom *m2 = x->m2.atombuffer+2;
- int n = argc-2;
-
- if (argc<2){ post("mtx_div: crippled matrix"); return; }
- if ((col<1)||(row<1)) { post("mtx_div: invalid dimensions"); return; }
- if (col*row>argc-2){ post("sparse matrix not yet supported : use \"mtx_check\""); return; }
- if (!(x->m2.col*x->m2.row)) {
- adjustsize(&x->m, row, col);
- matrix_set(&x->m, 0);
- outlet_anything(x->x_obj.ob_outlet, gensym("matrix"), argc, x->m.atombuffer);
- return;
- }
- if ((col!=x->m2.col)||(row!=x->m2.row)){ post("matrix dimension do not match"); /* LATER SOLVE THIS */ return; }
-
- adjustsize(&x->m, row, col);
- m = x->m.atombuffer+2;
-
- while(n--){
- t_float f = atom_getfloat(argv++)/atom_getfloat(m2++);
- SETFLOAT(m, f);
- m++;
- }
-
- outlet_anything(x->x_obj.ob_outlet, gensym("matrix"), argc, x->m.atombuffer);
-}
-static void mtx_divelement_float(t_mtx_binmtx *x, t_float f)
-{
- t_matrix *m=&x->m, *m2=&x->m2;
- t_atom *ap, *ap2=m2->atombuffer+2;
- int row2, col2, n;
-
- if (!m2->atombuffer){ post("divide by what ?"); return; }
-
- row2=atom_getfloat(m2->atombuffer);
- col2=atom_getfloat(m2->atombuffer+1);
- adjustsize(m, row2, col2);
- ap=m->atombuffer+2;
-
- n=row2*col2;
-
- while(n--){
- SETFLOAT(ap, f/atom_getfloat(ap2++));
- ap++;
- }
-
- outlet_anything(x->x_obj.ob_outlet, gensym("matrix"), m->row*m->col+2, m->atombuffer);
-}
-static void mtx_divscalar_matrix(t_mtx_binscalar *x, t_symbol *s, int argc, t_atom *argv)
-{
- int n=argc-2;
- t_atom *m;
- t_float factor = 1.0/x->f;
- int row=atom_getfloat(argv++);
- int col=atom_getfloat(argv++);
-
- if (argc<2){
- post("mtx_div: crippled matrix");
- return;
- }
- adjustsize(&x->m, row, col);
- m = x->m.atombuffer+2;
-
- while(n--){
- m->a_type = A_FLOAT;
- (m++)->a_w.w_float = atom_getfloat(argv++)*factor;
- }
-
- outlet_anything(x->x_obj.ob_outlet, gensym("matrix"), argc, x->m.atombuffer);
-}
-static void mtx_divscalar_list(t_mtx_binscalar *x, t_symbol *s, int argc, t_atom *argv)
-{
- int n=argc;
- t_atom *m;
- t_float factor = 1.0/x->f;
-
- adjustsize(&x->m, 1, argc);
- m = x->m.atombuffer;
-
- while(n--){
- m->a_type = A_FLOAT;
- (m++)->a_w.w_float = atom_getfloat(argv++)*factor;
- }
-
- outlet_list(x->x_obj.ob_outlet, gensym("list"), argc, x->m.atombuffer);
-}
-
-static void *mtx_div_new(t_symbol *s, int argc, t_atom *argv)
-{
- if (argc>1) post("mtx_div : extra arguments ignored");
- if (argc) {
- /* scalar division */
- t_mtx_binscalar *x = (t_mtx_binscalar *)pd_new(mtx_divscalar_class);
- floatinlet_new(&x->x_obj, &x->f);
- x->f = atom_getfloatarg(0, argc, argv);
- outlet_new(&x->x_obj, 0);
- return(x);
- } else {
- /* element division */
- t_matrix *x = (t_matrix *)pd_new(mtx_divelement_class);
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("matrix"), gensym(""));
- outlet_new(&x->x_obj, 0);
- x->col = x->row = 0;
- x->atombuffer = 0;
- return(x);
- }
-}
-
-static void mtx_div_setup(void)
-{
- mtx_divelement_class = class_new(gensym("mtx_./"), (t_newmethod)mtx_div_new, (t_method)mtx_binmtx_free,
- sizeof(t_mtx_binmtx), 0, A_GIMME, 0);
- class_addmethod(mtx_divelement_class, (t_method)mtx_divelement_matrix, gensym("matrix"), A_GIMME, 0);
- class_addmethod(mtx_divelement_class, (t_method)mtx_bin_matrix2, gensym(""), A_GIMME, 0);
- class_addfloat (mtx_divelement_class, mtx_divelement_float);
- class_addbang (mtx_divelement_class, mtx_binmtx_bang);
-
- mtx_divscalar_class = class_new(gensym("mtx_./"), 0, (t_method)mtx_binscalar_free,
- sizeof(t_mtx_binscalar), 0, 0);
- class_addmethod(mtx_divscalar_class, (t_method)mtx_divscalar_matrix, gensym("matrix"), A_GIMME, 0);
- class_addlist (mtx_divscalar_class, mtx_divscalar_list);
- class_addbang (mtx_divscalar_class, mtx_binscalar_bang);
-
- class_sethelpsymbol(mtx_divelement_class, gensym("zexy/mtx_binops"));
- class_sethelpsymbol(mtx_divscalar_class, gensym("zexy/mtx_binops"));
-}
-
-/* mtx_inverse */
-static t_class *mtx_inverse_class;
-
-static void mtx_inverse_matrix(t_matrix *x, t_symbol *s, int argc, t_atom *argv)
-{
- /* maybe we should do this in double or long double ? */
- int row=atom_getfloat(argv);
- int col=atom_getfloat(argv+1);
- int i, k, row2=row*row;
-
- T_FLOAT *original, *inverted;
- T_FLOAT *a1, *a2, *b1, *b2; // dummy pointers
-
- int ok = 0;
-
- if(row*col+2>argc){
- post("mtx_print : sparse matrices not yet supported : use \"mtx_check\"");
- return;
- }
- if (row!=col){
- post("mtx_inverse: only square matrices can be inverted");
- return;
- }
-
- // reserve memory for outputting afterwards
- adjustsize(x, row, row);
- // 1. get the 2 matrices : orig; invert (create as eye, but will be orig^(-1))
- inverted = (T_FLOAT *)getbytes(sizeof(T_FLOAT)*row2);
- // 1a extract values of A to float-buf
- original=matrix2float(argv);
- // 1b make an eye-shaped float-buf for B
- i=row2;
- b1=inverted;
- while(i--)*b1++=0;
- i=row;
- b1=inverted;
- while(i--)b1[i*(row+1)]=1;
-
- // 2. do the Gauss-Jordan
- for (k=0;k<row;k++) {
- // 2. adjust current row
- T_FLOAT diagel = original[k*(col+1)];
-#if 1
- T_FLOAT i_diagel = diagel?1./diagel:0;
- if (!diagel)ok++;
-#else
- T_FLOAT i_diagel = 1./diagel;
-#endif
-
- /* normalize current row (set the diagonal-element to 1 */
- a2=original+k*col;
- b2=inverted+k*col;
- i=row;
- while(i--){
- *a2++*=i_diagel;
- *b2++*=i_diagel;
- }
- /* eliminate the k-th element in each row by adding the weighted normalized row */
-
- a2=original+k*row;
- b2=inverted+k*row;
- for(i=0;i<row;i++)
- if (i-k) {
- T_FLOAT f=-*(original+i*row+k);
- int j = row;
- a1=original+i*row;
- b1=inverted+i*row;
- while (j--) {
- *(a1+j)+=f**(a2+j);
- *(b1+j)+=f**(b2+j);
- }
- }
- }
- // 3. output the matrix
- // 3a convert the floatbuf to an atombuf;
- float2matrix(x->atombuffer, inverted);
- // 3b destroy the buffers
- freebytes(original, sizeof(T_FLOAT)*row2);
-
- if (ok)post("mtx_inverse: couldn't really invert the matrix !!! %d error%c", ok, (ok-1)?'s':0);
-
- // 3c output the atombuf;
- matrix_bang(x);
-}
-
-static void *mtx_inverse_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_matrix *x = (t_matrix *)pd_new(mtx_inverse_class);
- outlet_new(&x->x_obj, 0);
- x->col=x->row=0;
- x->atombuffer=0;
-
- return (x);
-}
-static void mtx_inverse_setup(void)
-{
- mtx_inverse_class = class_new(gensym("mtx_inverse"), (t_newmethod)mtx_inverse_new,
- (t_method)matrix_free, sizeof(t_matrix), 0, A_GIMME, 0);
- class_addbang (mtx_inverse_class, matrix_bang);
- class_addmethod(mtx_inverse_class, (t_method)mtx_inverse_matrix, gensym("matrix"), A_GIMME, 0);
- class_sethelpsymbol(mtx_inverse_class, gensym("zexy/mtx_inverse"));
-}
-
-
-/* mtx_pivot */
-static t_class *mtx_pivot_class;
-
-typedef struct _mtx_pivot
-{
- t_object x_obj;
-
- t_matrix m; // the output matrix
- t_matrix m_pre; // the pre -multiply matrix
- t_matrix m_post; // the post-multiply matrix
-
- t_outlet *pivo, *pre, *post;
-
-} t_mtx_pivot;
-
-static void mtx_pivot_matrix(t_mtx_pivot *x, t_symbol *s, int argc, t_atom *argv)
-{
- int row=atom_getfloat(argv);
- int col=atom_getfloat(argv+1);
- t_atom *m_pre, *m_post;
- int i, j, k;
- int min_rowcol = (row<col)?row:col;
- T_FLOAT *buffer, *buf;
- int *i_pre, *i_post, *i_buf;
-
- int pivot_row, pivot_col;
-
- if (argc<2){ post("mtx_pivot: crippled matrix"); return; }
- if ((col<1)||(row<1)) { post("mtx_pivot: invalid dimensions"); return; }
- if (col*row>argc-2){ post("sparse matrix not yet supported : use \"mtx_check\""); return; }
-
- adjustsize(&x->m, row, col);
- adjustsize(&x->m_pre, row, row);
- adjustsize(&x->m_post,col, col);
- matrix_set(&x->m_pre, 0);
- matrix_set(&x->m_post, 0);
-
- buffer = matrix2float(argv);
- i_pre = (int *)getbytes(sizeof(int)*row);
- i_post = (int *)getbytes(sizeof(int)*col);
-
- /* clear pre&post matrices */
- i=row;
- i_buf=i_pre;
- while(i--)*i_buf++=row-i-1;
- i=col;
- i_buf=i_post;
- while(i--)*i_buf++=col-i-1;
-
- /* do the pivot thing */
-
- for (k=0; k<min_rowcol-1; k++){
- // 1. find max_element
- T_FLOAT max = 0;
- pivot_row = pivot_col = k;
-
- for(i=k; i<row; i++){
- buf=buffer+col*i+k;
-
- j=col-k;
- while(j--){
- T_FLOAT f = fabsf(*buf++);
- if (f>max) {
- max=f;
- pivot_row = i;
- pivot_col = col-j-1;
- }
- }
- }
- // 2. move max el to [k,k]
- // 2a swap rows
- if (k-pivot_row) {
- T_FLOAT *oldrow=buffer+col*k;
- T_FLOAT *newrow=buffer+col*pivot_row;
-
- i=col;
- while(i--){
- T_FLOAT f=*oldrow;
- *oldrow++=*newrow;
- *newrow++=f;
- }
- i=i_pre[k];
- i_pre[k]=i_pre[pivot_row];
- i_pre[pivot_row]=i;
- }
- // 2b swap columns
- if (k-pivot_col) {
- T_FLOAT *oldcol=buffer+k;
- T_FLOAT *newcol=buffer+pivot_col;
-
- i=row;
- while(i--){
- T_FLOAT f=*oldcol;
- *oldcol=*newcol;
- *newcol=f;
- oldcol+=col;
- newcol+=col;
- }
- i=i_post[k];
- i_post[k]=i_post[pivot_col];
- i_post[pivot_col]=i;
- }
- }
-
- float2matrix(x->m.atombuffer, buffer);
-
- i=col;
- m_post = x->m_post.atombuffer+2;
- while(i--){
- SETFLOAT(m_post+i_post[i]*col+i, 1);
- }
- i=row;
- m_pre = x->m_pre.atombuffer+2;
- while(i--)SETFLOAT(m_pre+i_pre[i]+i*col, 1);
-
-
- outlet_anything(x->post, gensym("matrix"), 2+col*col, x->m_post.atombuffer);
- outlet_anything(x->pre, gensym("matrix"), 2+row*row, x->m_pre.atombuffer);
- outlet_anything(x->pivo , gensym("matrix"), 2+row*col, x->m.atombuffer );
-}
-
-static void mtx_pivot_free(t_mtx_pivot *x)
-{
- matrix_free(&x->m);
- matrix_free(&x->m_pre);
- matrix_free(&x->m_post);
-}
-
-static void *mtx_pivot_new(void)
-{
- t_mtx_pivot *x = (t_mtx_pivot *)pd_new(mtx_pivot_class);
-
- x->pivo = outlet_new(&x->x_obj, 0);
- x->pre = outlet_new(&x->x_obj, 0);
- x->post = outlet_new(&x->x_obj, 0);
-
- x->m.atombuffer = x->m_pre.atombuffer = x->m_post.atombuffer = 0;
- x->m.row = x->m.col = x->m_pre.row = x->m_pre.col = x->m_post.row = x->m_post.col = 0;
-
- return(x);
-}
-
-static void mtx_pivot_setup(void)
-{
- mtx_pivot_class = class_new(gensym("mtx_pivot"), (t_newmethod)mtx_pivot_new, (t_method)mtx_pivot_free,
- sizeof(t_mtx_pivot), 0, 0, 0);
- class_addmethod(mtx_pivot_class, (t_method)mtx_pivot_matrix, gensym("matrix"), A_GIMME, 0);
-
- class_sethelpsymbol(mtx_pivot_class, gensym("zexy/mtx_transpose"));
-}
-
-
-/* -­------------------------------------------------------------- */
-/* utilities */
-/* mtx_check */
-static t_class *mtx_check_class;
-
-static void mtx_check_matrix(t_matrix *x, t_symbol *s, int argc, t_atom *argv)
-{
- int row=atom_getfloat(argv);
- int col=atom_getfloat(argv+1);
- t_atom *ap;
- int length=row*col, n;
- argc-=2;
-
- if(length>argc) {
- /* sparse matrix */
- adjustsize(x, row, col);
- matrix_set(x, 0);
- argv+=2;
- ap=x->atombuffer+2;
- n=argc;
- while(n--){
- t_float f = atom_getfloat(argv++);
- SETFLOAT(ap, f);
- ap++;
- }
- matrix_bang(x);
- } else {
- SETFLOAT(argv, row);
- SETFLOAT(argv+1, col);
- ap=argv+2;
- n=length;
- while(n--){
- t_float f = atom_getfloat(ap);
- SETFLOAT(ap, f);
- ap++;
- }
- outlet_anything(x->x_obj.ob_outlet, gensym("matrix"), length+2, argv);
- }
-}
-
-static void *mtx_check_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_matrix *x = (t_matrix *)pd_new(mtx_check_class);
- outlet_new(&x->x_obj, 0);
- x->col=x->row=0;
- x->atombuffer=0;
- return (x);
-}
-static void mtx_check_setup(void)
-{
- mtx_check_class = class_new(gensym("mtx_check"), (t_newmethod)mtx_check_new,
- (t_method)matrix_free, sizeof(t_matrix), 0, A_GIMME, 0);
- class_addbang (mtx_check_class, matrix_bang);
- class_addmethod(mtx_check_class, (t_method)mtx_check_matrix, gensym("matrix"), A_GIMME, 0);
- class_sethelpsymbol(mtx_check_class, gensym("zexy/matrix"));
-}
-
-/* mtx_size */
-static t_class *mtx_size_class;
-typedef struct _mtx_size
-{
- t_object x_obj;
-
- int row;
- int col;
-
- t_outlet *left, *right;
-} t_mtx_size;
-
-static void mtx_size_matrix(t_mtx_size *x, t_symbol *s, int argc, t_atom *argv)
-{
- if(argc<2)return;
- outlet_float(x->right, atom_getfloat(argv+1));
- outlet_float(x->left, atom_getfloat(argv));
-
-}
-
-static void *mtx_size_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_mtx_size *x = (t_mtx_size *)pd_new(mtx_size_class);
- x->left = outlet_new(&x->x_obj, 0);
- x->right = outlet_new(&x->x_obj, 0);
-
- return (x);
-}
-static void mtx_size_setup(void)
-{
- mtx_size_class = class_new(gensym("mtx_size"), (t_newmethod)mtx_size_new,
- 0, sizeof(t_mtx_size), 0, A_GIMME, 0);
- class_addmethod(mtx_size_class, (t_method)mtx_size_matrix, gensym("matrix"), A_GIMME, 0);
- class_sethelpsymbol(mtx_size_class, gensym("zexy/mtx_size"));
-}
-
-/* mtx_print */
-static t_class *mtx_print_class;
-static void mtx_print(t_matrix *x, t_symbol *s, int argc, t_atom *argv)
-{
- int col, row;
- if (argc<2){
- post("mtx_print : crippled matrix");
- return;
- }
- row = atom_getfloat(argv++);
- col = atom_getfloat(argv++);
- if(row*col>argc-2){
- post("mtx_print : sparse matrices not yet supported : use \"mtx_check\"");
- return;
- }
- post("matrix:");
- while(row--){
- postatom(col, argv);
- argv+=col;
- endpost();
- }
- endpost();
-}
-static void *mtx_print_new(void)
-{
- t_matrix *x = (t_matrix *)pd_new(mtx_print_class);
- x->row = x->col = 0;
- x->atombuffer = 0;
- return (x);
-}
-static void mtx_print_setup(void)
-{
- mtx_print_class = class_new(gensym("mtx_print"), (t_newmethod)mtx_print_new,
- 0, sizeof(t_matrix), 0, 0, 0);
- class_addmethod (mtx_print_class, (t_method)mtx_print, gensym("matrix"), A_GIMME, 0);
- class_sethelpsymbol(mtx_print_class, gensym("zexy/matrix"));
-}
-
-
-/* -------------- overall setup routine for this file ----------------- */
-
-void z_matrix_setup(void)
-{
- matrix_setup();
-
- mtx_resize_setup();
- mtx_row_setup();
- mtx_col_setup();
- mtx_element_setup();
-
- mtx_eye_setup();
- mtx_egg_setup();
- mtx_zeros_setup();
- mtx_ones_setup();
- mtx_diag_setup();
- mtx_diegg_setup();
- mtx_trace_setup();
-
- mtx_transpose_setup();
- mtx_scroll_setup();
- mtx_roll_setup();
-
- mtx_mean_setup();
- mtx_rand_setup();
-
- mtx_add_setup();
- mtx_sub_setup();
- mtx_mul_setup();
- mtx_div_setup();
- mtx_inverse_setup();
- mtx_pivot_setup();
-
- mtx_size_setup();
-
- mtx_check_setup();
- mtx_print_setup();
-
- if (0) debugmtx(0,0,0); /* this is to avoid this compiler warning... */
-}
diff --git a/src/z_nop.c b/src/z_nop.c
deleted file mode 100644
index 6fa6ac0..0000000
--- a/src/z_nop.c
+++ /dev/null
@@ -1,78 +0,0 @@
-#include "zexy.h"
-#ifdef NT
-#pragma warning( disable : 4244 )
-#pragma warning( disable : 4305 )
-#endif
-
-/* ------------------------ nop~ ----------------------------- */
-/* this will pass trough the signal unchanged except for a delay of 1 block */
-
-static t_class *nop_class;
-
-typedef struct _nop
-{
- t_object x_obj;
- t_float *buf;
- int n;
- int toggle;
-} t_nop;
-
-static t_int *nop_perform(t_int *w)
-{
- t_float *in = (t_float *)w[1];
- t_float *out = (t_float *)w[2];
- t_nop *x = (t_nop *)w[3];
- int n = x->n;
- t_float *rp = x->buf + n * x->toggle, *wp = x->buf + n * (x->toggle ^= 1);
-
- while (n--) {
- *wp++ = *in++;
- *out++ = *rp++;
- }
-
- return (w+4);
-}
-
-static void nop_dsp(t_nop *x, t_signal **sp)
-{
- if (x->n != sp[0]->s_n)
- {
- freebytes(x->buf, x->n * 2 * sizeof(t_float));
-
- x->buf = (t_float *)getbytes(sizeof(t_float) * 2 * (x->n = sp[0]->s_n));
- }
- dsp_add(nop_perform, 3, sp[0]->s_vec, sp[1]->s_vec, x);
-}
-
-static void helper(t_nop *x)
-{
- post("%c nop~-object ::\tdo_nothing but delay a signal for 1 block\n"
- "\t\t this might be helpful for synchronising signals", HEARTSYMBOL);
-}
-
-static void nop_free(t_nop *x)
-{
- freebytes(x->buf, x->n * sizeof(t_float));
-}
-
-
-static void *nop_new()
-{
- t_nop *x = (t_nop *)pd_new(nop_class);
- outlet_new(&x->x_obj, gensym("signal"));
- x->toggle = 0;
- x->n = 0;
-
- return (x);
-}
-
-void z_nop_setup(void)
-{
- nop_class = class_new(gensym("nop~"), (t_newmethod)nop_new, (t_method)nop_free,
- sizeof(t_nop), 0, A_DEFFLOAT, 0);
- class_addmethod(nop_class, nullfn, gensym("signal"), 0);
- class_addmethod(nop_class, (t_method)nop_dsp, gensym("dsp"), 0);
-
- class_addmethod(nop_class, (t_method)helper, gensym("help"), 0);
- class_sethelpsymbol(nop_class, gensym("zexy/nop~"));
-}
diff --git a/src/z_pack.c b/src/z_pack.c
deleted file mode 100644
index 6484093..0000000
--- a/src/z_pack.c
+++ /dev/null
@@ -1,350 +0,0 @@
-/* 3108:forum::für::umläute:2000 */
-
-/* objects for manipulating packages*/
-
-/*
- repack : (re)pack floats/symbols/pointers to fixed-length packages
- niagara : divides a package into 2 sub-packages
- packel : get a specifique element of a package by its index
-*/
-
-#include "zexy.h"
-#include <string.h>
-#ifdef NT
-#include <memory.h>
-//#error do we need memory.h
-#endif
-
-
-/* -------------------- repack ------------------------------ */
-
-/*
-(re)pack a sequence of (packages of) atoms into a package of given length
-
-"bang" gives out the current package immediately
-the second inlet lets you change the default package size
-*/
-
-static t_class *repack_class;
-
-typedef struct _repack
-{
- t_object x_obj;
- t_atom *buffer;
- int bufsize;
-
- int outputsize;
- int current;
-} t_repack;
-
-
-static void repack_set(t_repack *x, t_float f)
-{
- /* set the new default size */
- int n = f;
-
- if (n > 0) {
-
- /* flush all the newsized packages that are in the buffer */
- t_atom *dumbuf = x->buffer;
- int dumcur = x->current;
-
- while (n <= dumcur) {
- outlet_list(x->x_obj.ob_outlet, gensym("list"), n, dumbuf);
- dumcur -= n;
- dumbuf += n;
- }
-
- if (dumcur < 0) error("this should never happen :: dumcur = %d < 0", dumcur);
- else {
- memcpy(x->buffer, dumbuf, dumcur * sizeof(t_atom));
- x->current = dumcur;
- }
-
- if (n > x->bufsize) {
- dumbuf = (t_atom *)getbytes(n * sizeof(t_atom));
- memcpy(dumbuf, x->buffer, x->current * sizeof(t_atom));
- freebytes(x->buffer, x->bufsize * sizeof(t_atom));
- x->buffer = dumbuf;
- x->bufsize = n;
- }
-
- x->outputsize = n;
- }
-}
-
-static void repack_bang(t_repack *x)
-{
- /* output the list as far as we are now */
- outlet_list(x->x_obj.ob_outlet, gensym("list"), x->current, x->buffer);
- x->current = 0;
-}
-
-static void repack_float(t_repack *x, t_float f)
-{
- /* add a float-atom to the list */
- SETFLOAT(&x->buffer[x->current], f);
- x->current++;
- if (x->current >= x->outputsize) repack_bang(x);
-}
-
-static void repack_symbol(t_repack *x, t_symbol *s)
-{
- /* add a sym-atom to the list */
- SETSYMBOL(&x->buffer[x->current], s);
- x->current++;
- if (x->current >= x->outputsize) repack_bang(x);
-}
-static void repack_pointer(t_repack *x, t_gpointer *p)
-{
- /* add a pointer-atom to the list */
- SETPOINTER(&x->buffer[x->current], p);
- x->current++;
- if (x->current >= x->outputsize) repack_bang(x);
-}
-static void repack_list(t_repack *x, t_symbol *s, int argc, t_atom *argv)
-{
- int remain = x->outputsize - x->current;
- t_atom *ap = argv;
-
- if (argc >= remain) {
- memcpy(x->buffer+x->current, ap, remain * sizeof(t_atom));
- ap += remain;
- argc -= remain;
- outlet_list(x->x_obj.ob_outlet, gensym("list"), x->outputsize, x->buffer);
- x->current = 0;
- }
-
- while (argc >= x->outputsize) {
- outlet_list(x->x_obj.ob_outlet, gensym("list"), x->outputsize, ap);
- ap += x->outputsize;
- argc -= x->outputsize;
- }
-
- memcpy(x->buffer + x->current, ap, argc * sizeof(t_atom));
- x->current += argc;
-}
-static void repack_anything(t_repack *x, t_symbol *s, int argc, t_atom *argv)
-{
- SETSYMBOL(&x->buffer[x->current], s);
- x->current++;
-
- if (x->current >= x->outputsize) {
- repack_bang(x);
- }
- repack_list(x, gensym("list"), argc, argv);
-}
-
-static void *repack_new(t_floatarg f)
-{
- t_repack *x = (t_repack *)pd_new(repack_class);
-
-
-
- x->outputsize = x->bufsize = (f>0.f)?f:2 ;
- x->current = 0;
-
-
- x->buffer = (t_atom *)getbytes(x->bufsize * sizeof(t_atom));
-
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"), gensym(""));
- outlet_new(&x->x_obj, 0);
-
- return (x);
-}
-
-static void repack_setup(void)
-{
- repack_class = class_new(gensym("repack"), (t_newmethod)repack_new,
- 0, sizeof(t_repack), 0, A_DEFFLOAT, 0);
-
- class_addbang (repack_class, repack_bang);
- class_addfloat (repack_class, repack_float);
- class_addsymbol (repack_class, repack_symbol);
- class_addpointer (repack_class, repack_pointer);
- class_addlist (repack_class, repack_list);
- class_addanything(repack_class, repack_anything);
- class_addmethod (repack_class, (t_method)repack_set, gensym(""), A_DEFFLOAT, 0);
-
- class_sethelpsymbol(repack_class, gensym("zexy/repack"));
-}
-
-/* ------------------------- niagara ------------------------------- */
-
-/*
-divides a package into 2 sub-packages at a specified point
-like the niagara-falls, some water goes down to the left side, the rest to the right side, devided by the rock
-*/
-
-static t_class *niagara_class;
-
-typedef struct _niagara
-{
- t_object x_obj;
- t_float rock;
- t_outlet *left, *right;
-} t_niagara;
-
-static void niagara_list(t_niagara *x, t_symbol *s, int argc, t_atom *argv)
-{
- int n_l, n_r;
- t_atom *ap_l, *ap_r;
- int dumrock = x->rock;
- int rock = ((dumrock < 0.f)?(argc+dumrock):dumrock);
-
- n_l = (rock < argc)?rock:argc;
- ap_l = argv;
-
- n_r = argc - n_l;
- ap_r = &argv[n_l];
-
- if (n_r) outlet_list(x->right, s, n_r, ap_r);
- if (n_l) outlet_list(x->left, s, n_l, ap_l);
-}
-
-static void niagara_any(t_niagara *x, t_symbol *s, int argc, t_atom *argv)
-{
- int n_l, n_r;
- t_atom *ap_l, *ap_r;
- t_symbol *s_r, *s_l;
- int dumrock = x->rock;
- int rock = ((dumrock < 0.f)?(argc+dumrock):dumrock-1);
-
- n_l = (rock < argc)?rock:argc;
- ap_l = argv;
- s_l = s;
-
- n_r = argc - n_l;
- ap_r = &argv[n_l];
-
- if (n_r) {
- s_r = 0;
- if (ap_r->a_type == A_FLOAT) s_r = gensym("list");
- else {
- s_r = atom_getsymbol(ap_r);
- ap_r++;
- n_r--;
- }
- outlet_anything(x->right, s_r, n_r, ap_r);
- }
-
- if (n_l+1 ) outlet_anything(x->left, s_l, n_l, ap_l);
-}
-
-static void *niagara_new(t_floatarg f)
-{
- t_niagara *x = (t_niagara *)pd_new(niagara_class);
-
- x->rock = f;
-
- x->left = outlet_new(&x->x_obj, &s_list);
- x->right = outlet_new(&x->x_obj, &s_list);
-
- floatinlet_new(&x->x_obj, &x->rock);
-
- return (x);
-}
-
-static void niagara_setup(void)
-{
- niagara_class = class_new(gensym("niagara"), (t_newmethod)niagara_new,
- 0, sizeof(t_niagara), 0, A_DEFFLOAT, 0);
-
- class_addlist (niagara_class, niagara_list);
- class_addanything(niagara_class, niagara_any);
-
- class_sethelpsymbol(niagara_class, gensym("zexy/niagara"));
-}
-
-/* ------------------------- packel ------------------------------- */
-
-/*
-get the nth element of a package
-*/
-
-static t_class *packel_class;
-
-typedef struct _packel
-{
- t_object x_obj;
- t_float position;
-} t_packel;
-
-static void packel_list(t_packel *x, t_symbol *s, int argc, t_atom *argv)
-{
- int mypos = x->position;
-
- if (mypos) {
- t_atom *current;
- int pos = (mypos < 0)?(argc+mypos):(mypos-1);
-
- if(argc==0){
- if (pos==0||pos==-1)outlet_bang(x->x_obj.ob_outlet);
- return;
- }
-
- if (pos < 0 || pos >= argc)return;
-
- current = &(argv[pos]);
-
- switch (current->a_type) {
- case A_FLOAT:
- outlet_float(x->x_obj.ob_outlet, atom_getfloat(current));
- break;
- case A_SYMBOL:
- outlet_symbol(x->x_obj.ob_outlet, atom_getsymbol(current));
- break;
- case A_POINTER:
- outlet_pointer(x->x_obj.ob_outlet, current->a_w.w_gpointer);
- break;
- case A_NULL:
- outlet_bang(x->x_obj.ob_outlet);
- default:
- ;
- }
- } else outlet_list(x->x_obj.ob_outlet, s, argc, argv);
-}
-
-static void packel_anything(t_packel *x, t_symbol *s, int argc, t_atom *argv)
-{
- t_atom *av2 = (t_atom *)getbytes((argc + 1) * sizeof(t_atom));
- int i;
-
- for (i = 0; i < argc; i++)
- av2[i + 1] = argv[i];
- SETSYMBOL(av2, s);
- packel_list(x, gensym("list"), argc+1, av2);
- freebytes(av2, (argc + 1) * sizeof(t_atom));
-}
-
-static void *packel_new(t_floatarg f)
-{
- t_packel *x = (t_packel *)pd_new(packel_class);
- outlet_new(&x->x_obj, 0);
- floatinlet_new(&x->x_obj, &x->position);
- x->position = (int) f;
-
- return (x);
-}
-
-static void packel_setup(void)
-{
- packel_class = class_new(gensym("packel"), (t_newmethod)packel_new,
- 0, sizeof(t_packel), 0, A_DEFFLOAT, 0);
-
- class_addlist (packel_class, packel_list);
- class_addanything(packel_class, packel_anything);
-
- class_sethelpsymbol(packel_class, gensym("zexy/packel"));
-}
-
-/* -------------- overall setup routine for this file ----------------- */
-
-void z_pack_setup(void)
-{
- repack_setup();
- niagara_setup();
- packel_setup();
-
- /* I don't supply HELP - functionality, since this might harm overall-performance ere */
-}
diff --git a/src/z_sigbin.c b/src/z_sigbin.c
index b1023e7..dc4932e 100644
--- a/src/z_sigbin.c
+++ b/src/z_sigbin.c
@@ -1,3 +1,19 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
/*
finally :: some of the missing binops for signals :: abs~, sgn~, >~, <~, ==~, &&~, ||~
@@ -9,8 +25,6 @@
#ifdef NT
#define fabsf fabs
-#pragma warning( disable : 4244 )
-#pragma warning( disable : 4305 )
#endif
typedef struct _misc
@@ -798,4 +812,5 @@ void z_sigbin_setup(void)
sigEQUAL_setup();
sigOR_setup();
sigAND_setup();
+ zexy_register("sigbin");
}
diff --git a/src/z_sigmatrix.c b/src/z_sigmatrix.c
deleted file mode 100644
index f801950..0000000
--- a/src/z_sigmatrix.c
+++ /dev/null
@@ -1,506 +0,0 @@
-#include "zexy.h"
-
-#ifdef NT
-#pragma warning( disable : 4244 )
-#pragma warning( disable : 4305 )
-#endif
-
-/* the sigmatrix objects ::
- matrix~ : multiply a n-vector of in~ with a matrix to get a m-vector of out~
- line~ between the 2 matrices, to make it useable as a mixer
- multiplex~ : multiplex 1-of-n in~ to 1 out~
- demultiplex~ : demultiplex 1 in~ to 1-of-n out~
-
- to do :
- patchbay~ : array of mux~ and demux~
-
-*/
-
-
-/* --------------------------- matrix~ ----------------------------------
- *
- * multiply a n-vector of signals with a (n*m) matrix, to get m output-streams.
- * make the (n*m)-matrix of scalars to be liny~
- *
- * 1703:forum::für::umläute:2001
- */
-
-static t_class *sigmtx_class;
-
-typedef struct _sigmtx {
- t_object x_obj;
-
- t_float time;
- int ticksleft;
- int retarget;
- t_float msec2tick;
-
- t_float **value;
- t_float **target;
- t_float **increment; /* single precision is really a bad, especially when doing long line~s.
- * but the biginc (like in msp's line~ (d_ctl.c) is far too expensive... */
- t_float **sigIN;
- t_float **sigOUT;
- t_float *sigBUF;
-
- int n_sigIN; /* columns */
- int n_sigOUT; /* rows */
-} t_sigmtx;
-
-/* the message thing */
-
-static void sigmtx_matrix(t_sigmtx *x, t_symbol *s, int argc, t_atom *argv)
-{
- int col, row, c=0, r=0;
-
- if (argc<2){
- post("matrix~ : bad matrix !");
- return;
- }
-
- row = atom_getfloat(argv++);
- col = atom_getfloat(argv++);
- argc-=2;
-
- if((col!=x->n_sigOUT)||(row!=x->n_sigIN)){
- post("matrix~ : matrix dimensions do not match !!");
- return;
- }
- if(argc<row*col){
- post("matrix~ : reduced matrices not yet supported");
- return;
- }
-
- if (x->time<=0) {
- for(r=0; r<row; r++)
- for(c=0; c<col; c++)
- x->target[c][r]=x->value[c][r]=atom_getfloat(argv++);
- x->time=x->ticksleft=x->retarget=0;
- } else {
- for(r=0; r<row; r++)
- for(c=0; c<col; c++)
- x->target[c][r]=atom_getfloat(argv++);
- x->retarget=1;
- }
-}
-
-static void sigmtx_stop(t_sigmtx *x)
-{
- int c = x->n_sigOUT, r;
- t_float *tgt, *val;
- while(c--){
- tgt=x->target[c];
- val=x->value [c];
- r=x->n_sigIN;
- while(r--)*tgt++=*val++;
- }
- x->ticksleft = x->retarget = 0;
-}
-
-
-/* the dsp thing */
-
-static t_int *sigmtx_perform(t_int *w)
-{
- t_sigmtx *x = (t_sigmtx *)(w[1]);
- int n = (int)(w[2]);
-
- int r, c;
-
- t_float **out = x->sigOUT;
- t_float **in = x->sigIN;
-
- t_float *buf = x->sigBUF, *sigBUF = buf;
-
- t_float **value = x->value;
- t_float **target = x->target;
- t_float **increment = x->increment;
-
- t_float *inc, *val, *tgt;
-
- int n_IN=x->n_sigIN, n_OUT=x->n_sigOUT;
-
- if (x->retarget) {
- int nticks = x->time * x->msec2tick;
- t_float oneovernos;
-
- if (!nticks) nticks = 1;
- oneovernos = 1./(nticks*n);
- x->ticksleft = nticks;
-
- c = n_OUT;
- while(c--) {
- inc=increment[c];
- val=value[c];
- tgt=target[c];
- r=n_IN;
- while(r--)*inc++=(*tgt++-*val++)*oneovernos;
- }
-
- x->retarget = 0;
- }
-
- if (x->ticksleft) {
- int N=n-1;
- n=-1;
- // while (n--) {
- while(n++<N){
- c = n_OUT;
- while(c--) {
- t_float sum = 0;
- val = value[c]+n_IN-1;
- inc = increment[c]+n_IN-1;
- r=n_IN;
-
- while(r--)sum+=in[r][n]*(*val--+=*inc--);
-
- sigBUF[c]=sum;
- }
- buf = sigBUF;
- c = n_OUT;
- while(c--)out[c][n]=*buf++;
- }
- if (!--x->ticksleft) {
- c = n_OUT;
- while(c--){
- val=value[c];
- tgt=target[c];
- r=n_IN;
- while(r--)*val++=*tgt++;
- }
- }
- } else { /* no ticks left */
- while (n--) {
- c = n_OUT;
- while(c--) {
- t_float sum = 0;
- val = value[c]+n_IN-1;
- r = n_IN;
- while(r--)sum+=in[r][n]**val--;
- sigBUF[c]=sum;
- }
- buf = sigBUF;
- c = n_OUT;
- while(c--)out[c][n]=*buf++;
- }
- }
- return (w+3);
-}
-
-static void sigmtx_dsp(t_sigmtx *x, t_signal **sp)
-{
- int o = x->n_sigOUT, i=x->n_sigIN, n=0;
- t_float **dummy = x->sigIN;
-
- while(i--)*dummy++=sp[n++]->s_vec;
-
- dummy =x->sigOUT;
- while(o--)dummy[o]=sp[n++]->s_vec;
-
- x->msec2tick = sp[0]->s_sr / (1000.f * sp[0]->s_n);
- dsp_add(sigmtx_perform, 2, x, sp[0]->s_n);
-}
-
-
-/* setup/setdown things */
-
-static void sigmtx_free(t_sigmtx *x)
-{
- int i = x->n_sigOUT;
- while(i--) {
- freebytes(x->value [i], x->n_sigOUT * sizeof(t_float *));
- freebytes(x->target [i], x->n_sigOUT * sizeof(t_float *));
- freebytes(x->increment[i], x->n_sigOUT * sizeof(t_float *));
- }
-
- freebytes(x->value, sizeof(x->value));
- freebytes(x->target, sizeof(x->target));
- freebytes(x->increment, sizeof(x->increment));
-
- freebytes(x->sigIN, x->n_sigIN * sizeof(t_float *));
- freebytes(x->sigOUT, x->n_sigOUT * sizeof(t_float *));
- freebytes(x->sigBUF, x->n_sigOUT * sizeof(t_float ));
-}
-
-static void *sigmtx_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_sigmtx *x = (t_sigmtx *)pd_new(sigmtx_class);
- int i;
-
- x->time = 0;
-
- switch (argc) {
- case 0:
- x->n_sigIN = x->n_sigOUT = 1;
- break;
- case 1:
- x->n_sigIN = x->n_sigOUT = atom_getfloat(argv);
- break;
- default:
- x->time= atom_getfloat(argv+2);
- case 2:
- x->n_sigIN = atom_getfloat(argv);
- x->n_sigOUT = atom_getfloat(argv+1);
- break;
- }
-
- if (x->time<0) x->time=0;
- if (x->n_sigIN <1) x->n_sigIN =1;
- if (x->n_sigOUT<1) x->n_sigOUT=1;
-
- /* the inlets */
- i=x->n_sigIN-1;
- while(i--)inlet_new(&x->x_obj,&x->x_obj.ob_pd,&s_signal,&s_signal);
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("matrix"), gensym(""));
- floatinlet_new(&x->x_obj, &x->time);
-
- /* the outlets */
- i=x->n_sigOUT;
- while(i--)outlet_new(&x->x_obj,&s_signal);
-
- /* make all the buffers */
- x->sigIN = (t_float **)getbytes(x->n_sigIN * sizeof(t_float *));
- x->sigOUT = (t_float **)getbytes(x->n_sigOUT * sizeof(t_float *));
- x->sigBUF = (t_float *)getbytes(x->n_sigOUT * sizeof(t_float ));
-
- x->value = (t_float **)getbytes(x->n_sigOUT * sizeof(t_float));
- x->target = (t_float **)getbytes(x->n_sigOUT * sizeof(t_float));
- x->increment = (t_float **)getbytes(x->n_sigOUT * sizeof(t_float));
-
- i = x->n_sigOUT;
- while(i--){
- int j = x->n_sigIN;
- x->sigOUT [i] = 0;
- x->value [i] = (t_float *)getbytes(x->n_sigIN * sizeof(t_float));
- x->target [i] = (t_float *)getbytes(x->n_sigIN * sizeof(t_float));
- x->increment[i] = (t_float *)getbytes(x->n_sigIN * sizeof(t_float));
-
- while(j--)x->value[i][j]=x->target[i][j]=x->increment[i][j]=0;
- }
-
- i = x->n_sigIN;
- while(i--)x->sigIN[i] = 0;
-
- x->msec2tick = x->ticksleft = x->retarget = 0;
- return (x);
-}
-
-static void sigmtx_setup(void)
-{
- sigmtx_class = class_new(gensym("matrix~"), (t_newmethod)sigmtx_new, (t_method)sigmtx_free,
- sizeof(t_sigmtx), 0, A_GIMME, 0);
-
- class_addmethod(sigmtx_class, (t_method)sigmtx_dsp, gensym("dsp"), 0);
- class_addmethod(sigmtx_class, nullfn, gensym("signal"), 0);
-
- class_addmethod(sigmtx_class, (t_method)sigmtx_matrix, gensym(""), A_GIMME, 0);
- class_addmethod(sigmtx_class, (t_method)sigmtx_stop, gensym("stop"), 0);
-
- class_sethelpsymbol(sigmtx_class, gensym("zexy/matrix~"));
-}
-
-/* ------------------------------------------------------------------------------ */
-
-/* demux~ : demultiplex a signal to a specified output */
-
-static t_class *demux_class;
-
-typedef struct _demux {
- t_object x_obj;
-
- int output;
-
- int n_out;
- t_float **out;
-
-} t_demux;
-
-static void demux_output(t_demux *x, t_floatarg f)
-{
- if ((f>=0)&&(f<x->n_out)){
- x->output=f;
- } else
- error("demultiplex: %d is channel out of range (0..%d)", (int)f, x->n_out);
-}
-
-
-static t_int *demux_perform(t_int *w)
-{
- t_demux *x = (t_demux *)(w[1]);
- t_float *in = (t_float *)(w[2]);
- int N = (int)(w[3]);
- int n = N;
-
-
- int channel=x->n_out;
-
-
- while(channel--){
- t_float*out=x->out[channel];
- n=N;
- if(x->output==channel){
- while(n--)*out++=*in++;
- } else
- while(n--)*out++=0.f;
- }
- return (w+4);
-}
-
-static void demux_dsp(t_demux *x, t_signal **sp)
-{
- int n = x->n_out;
- t_float **dummy=x->out;
- while(n--)*dummy++=sp[x->n_out-n]->s_vec;
- dsp_add(demux_perform, 3, x, sp[0]->s_vec, sp[0]->s_n);
-}
-
-
-static void demux_helper(void)
-{
- post("\n%c demux~\t:: demultiplex a signal to one of various outlets", HEARTSYMBOL);
- post("<#out>\t : the outlet-number (counting from 0) to witch the inlet is routed"
- "'help'\t : view this");
- post("creation : \"demux~ [arg1 [arg2...]]\"\t: the number of arguments equals the number of outlets\n");
-}
-
-static void demux_free(t_demux *x)
-{
- freebytes(x->out, x->n_out * sizeof(t_float *));
-}
-
-static void *demux_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_demux *x = (t_demux *)pd_new(demux_class);
- int i;
-
- if (!argc)argc=2;
- x->n_out=argc;
- x->output=0;
-
- while(argc--)outlet_new(&x->x_obj, gensym("signal"));
-
- x->out = (t_float **)getbytes(x->n_out * sizeof(t_float *));
- i=x->n_out;
- while(i--)x->out[i]=0;
-
- return (x);
-}
-
-void demux_setup(void)
-{
- demux_class = class_new(gensym("demultiplex~"), (t_newmethod)demux_new, (t_method)demux_free, sizeof(t_demux), 0, A_GIMME, 0);
- class_addcreator((t_newmethod)demux_new, gensym("demux~"), A_GIMME, 0);
-
- class_addfloat(demux_class, demux_output);
- class_addmethod(demux_class, (t_method)demux_dsp, gensym("dsp"), 0);
- class_addmethod(demux_class, nullfn, gensym("signal"), 0);
-
- class_addmethod(demux_class, (t_method)demux_helper, gensym("help"), 0);
- class_sethelpsymbol(demux_class, gensym("zexy/demultiplex~"));
-}
-
-
-/* ------------------------------------------------------------------------------ */
-
-/* mux~ : multiplex a specified signal to the output */
-
-static t_class *mux_class;
-
-typedef struct _mux {
- t_object x_obj;
-
- int input;
-
- int n_in;
- t_float **in;
-} t_mux;
-
-static void mux_input(t_mux *x, t_floatarg f)
-{
- if ((f>=0)&&(f<x->n_in)){
- x->input=f;
- } else
- error("multiplex: %d is channel out of range (0..%d)", (int)f, x->n_in);
-
-}
-
-static t_int *mux_perform(t_int *w)
-{
- t_mux *x = (t_mux *)(w[1]);
- t_float *out = (t_float *)(w[2]);
- int n = (int)(w[3]);
-
- t_float *in = x->in[x->input];
-
- while(n--)*out++=*in++;
-
- return (w+4);
-}
-
-static void mux_dsp(t_mux *x, t_signal **sp)
-{
- int n = 0;
- t_float **dummy=x->in;
-
- for(n=0;n<x->n_in;n++)*dummy++=sp[n]->s_vec;
-
- dsp_add(mux_perform, 3, x, sp[n]->s_vec, sp[0]->s_n);
-}
-
-static void mux_helper(void)
-{
- post("\n%c mux~\t:: multiplex a one of various signals to one outlet", HEARTSYMBOL);
- post("<#out>\t : the inlet-number (counting from 0) witch is routed to the outlet"
- "'help'\t : view this");
- post("creation : \"mux~ [arg1 [arg2...]]\"\t: the number of arguments equals the number of inlets\n");
-}
-
-static void mux_free(t_mux *x)
-{
- freebytes(x->in, x->n_in * sizeof(t_float *));
-}
-
-static void *mux_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_mux *x = (t_mux *)pd_new(mux_class);
- int i;
-
- if (!argc)argc=2;
- x->n_in=argc;
- x->input=0;
-
- argc--;
- while(argc--)inlet_new(&x->x_obj,&x->x_obj.ob_pd,&s_signal,&s_signal);
-
- x->in = (t_float **)getbytes(x->n_in * sizeof(t_float *));
- i=x->n_in;
- while(i--)x->in[i]=0;
-
- outlet_new(&x->x_obj, gensym("signal"));
-
- return (x);
-}
-
-void mux_setup(void)
-{
- mux_class = class_new(gensym("multiplex~"), (t_newmethod)mux_new, (t_method)mux_free, sizeof(t_mux), 0, A_GIMME, 0);
- class_addcreator((t_newmethod)mux_new, gensym("mux~"), A_GIMME, 0);
-
- class_addfloat(mux_class, mux_input);
- class_addmethod(mux_class, (t_method)mux_dsp, gensym("dsp"), 0);
- class_addmethod(mux_class, nullfn, gensym("signal"), 0);
-
- class_addmethod(mux_class, (t_method)mux_helper, gensym("help"), 0);
- class_sethelpsymbol(mux_class, gensym("zexy/multiplex~"));
-}
-
-/* ----------------------------------------------------------------------
- * main setup
- * ---------------------------------------------------------------------- */
-
-void z_sigmatrix_setup(void)
-{
- sigmtx_setup();
- demux_setup();
- mux_setup();
-}
diff --git a/src/z_skeleton.c b/src/z_skeleton.c
deleted file mode 100644
index e13c385..0000000
--- a/src/z_skeleton.c
+++ /dev/null
@@ -1,57 +0,0 @@
-
-/* 1008:forum::für::umläute:2001 */
-
-/*
- skeleton : skeleton-code for message-objects
-*/
-
-#include "zexy.h"
-
-/* ------------------------- skeleton ------------------------------- */
-
-/*
-MESSAGE SKELETON: simple and easy
-*/
-
-static t_class *skeleton_class;
-
-typedef struct _skeleton
-{
- t_object x_obj;
-
-} t_skeleton;
-
-
-static void skeleton_float(t_skeleton *x, t_float f)
-{
-
-}
-
-static void skeleton_list(t_skeleton *x, t_symbol *s, int argc, t_atom *argv)
-{
-
-}
-
-static void skeleton_foo(t_skeleton *x, t_float f)
-{
-
-}
-
-static void *skeleton_new(t_floatarg f)
-{
- t_skeleton *x = (t_skeleton *)pd_new(skeleton_class);
-
- return (x);
-}
-
-void z_skeleton_setup(void)
-{
- skeleton_class = class_new(gensym("skeleton"), (t_newmethod)skeleton_new,
- 0, sizeof(t_skeleton), 0, A_DEFFLOAT, 0);
-
- class_addlist (skeleton_class, skeleton_list);
- class_addfloat (skeleton_class, skeleton_float);
- class_addmethod(skeleton_class, (t_method)skeleton_foo, gensym("foo"), A_DEFFLOAT, 0);
-
- class_sethelpsymbol(skeleton_class, gensym("zexy/skeleton"));
-}
diff --git a/src/z_skeleton_tilde.c b/src/z_skeleton_tilde.c
deleted file mode 100644
index 4587afd..0000000
--- a/src/z_skeleton_tilde.c
+++ /dev/null
@@ -1,61 +0,0 @@
-#include <stdio.h>
-
-#include "zexy.h"
-
-#ifdef NT
-#pragma warning( disable : 4244 )
-#pragma warning( disable : 4305 )
-#endif
-
-/* skeleton~ : skeleton-code for a signal-object */
-
-/* ------------------------ skeleton~ ----------------------------- */
-
-static t_class *skeleton_class;
-
-typedef struct _skeleton
-{
- t_object x_obj;
-
-} t_skeleton;
-
-
-static t_int *skeleton_perform(t_int *w)
-{
- t_float *in = (t_float *)(w[1]);
- t_float *out = (t_float *)(w[2]);
- int n = (int)(w[3]);
- t_skeleton *x = (t_skeleton *) w[4];
-
- while (n--) {
- *in++=*out++;
- }
-
- return (w+5);
-}
-
-static void skeleton_dsp(t_skeleton *x, t_signal **sp)
-{
- dsp_add(skeleton_perform, 4, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n,x);
-}
-
-
-
-static void *skeleton_new()
-{
- t_skeleton *x = (t_skeleton *)pd_new(skeleton_class);
- outlet_new(&x->x_obj, gensym("signal"));
-
- return (x);
-}
-
-void z_skeleton_tilde_setup(void)
-{
- skeleton_class = class_new(gensym("skeleton~"), (t_newmethod)skeleton_new, 0,
- sizeof(t_skeleton), 0, A_DEFFLOAT, 0);
- class_addmethod(skeleton_class, nullfn, gensym("signal"), 0);
- class_addmethod(skeleton_class, (t_method)skeleton_dsp, gensym("dsp"), 0);
-
- class_sethelpsymbol(skeleton_class, gensym("zexy/skeleton~"));
-}
-
diff --git a/src/z_stat.c b/src/z_stat.c
deleted file mode 100644
index d667a5a..0000000
--- a/src/z_stat.c
+++ /dev/null
@@ -1,168 +0,0 @@
-#include "zexy.h"
-#include <math.h>
-
-#ifdef NT
-#pragma warning( disable : 4244 )
-#pragma warning( disable : 4305 )
-#define sqrtf sqrt
-#endif
-
-#ifdef MACOSX
-#define sqrtf sqrt
-#endif
-
-/* mean :: the mean of a list of floats */
-
-static t_class *mean_class;
-
-typedef struct _mean
-{
- t_object x_obj;
-} t_mean;
-
-static void mean_list(t_mean *x, t_symbol *s, int argc, t_atom *argv)
-{
- t_float factor = 1./argc;
- t_float sum = 0;
-
- while(argc--)sum+=atom_getfloat(argv++);
-
- outlet_float(x->x_obj.ob_outlet,sum*factor);
-}
-
-static void *mean_new(void)
-{
- t_mean *x = (t_mean *)pd_new(mean_class);
-
- outlet_new(&x->x_obj, gensym("float"));
-
- return (x);
-}
-
-static void mean_help(void)
-{
- post("mean\t:: calculate the mean of a list of floats");
-}
-
-static void mean_setup(void)
-{
- mean_class = class_new(gensym("mean"), (t_newmethod)mean_new, 0,
- sizeof(t_mean), 0, A_DEFFLOAT, 0);
-
- class_addlist(mean_class, (t_method)mean_list);
- class_addmethod(mean_class, (t_method)mean_help, gensym("help"), 0);
-
- class_sethelpsymbol(mean_class, gensym("zexy/mean"));
-}
-
-/* minmax :: get minimum and maximum of a list */
-
-static t_class *minmax_class;
-
-typedef struct _minmax
-{
- t_object x_obj;
- t_float min;
- t_float max;
-
- t_outlet *mino, *maxo;
-} t_minmax;
-
-static void minmax_bang(t_minmax *x)
-{
- outlet_float(x->maxo,x->max);
- outlet_float(x->mino,x->min);
-}
-
-static void minmax_list(t_minmax *x, t_symbol *s, int argc, t_atom *argv)
-{
- t_float min = atom_getfloat(argv++);
- t_float max=min;
- argc--;
-
- while(argc--){
- t_float f = atom_getfloat(argv++);
- if (f<min)min=f;
- else if (f>max)max=f;
- }
-
- x->min=min;
- x->max=max;
-
- minmax_bang(x);
-}
-
-static void *minmax_new(void)
-{
- t_minmax *x = (t_minmax *)pd_new(minmax_class);
-
- x->mino=outlet_new(&x->x_obj, gensym("float"));
- x->maxo=outlet_new(&x->x_obj, gensym("float"));
-
- x->min = x->max = 0;
-
- return (x);
-}
-
-static void minmax_help(void)
-{
- post("minmax\t:: get minimum and maximum of a list of floats");
-}
-
-static void minmax_setup(void)
-{
- minmax_class = class_new(gensym("minmax"), (t_newmethod)minmax_new, 0,
- sizeof(t_minmax), 0, A_DEFFLOAT, 0);
-
- class_addlist(minmax_class, (t_method)minmax_list);
- class_addbang(minmax_class, (t_method)minmax_bang);
- class_addmethod(minmax_class, (t_method)minmax_help, gensym("help"), 0);
-
- class_sethelpsymbol(minmax_class, gensym("zexy/minmax"));
-}
-
-/* length :: get minimum and maximum of a list */
-
-static t_class *length_class;
-
-typedef struct _length
-{
- t_object x_obj;
-} t_length;
-
-static void length_list(t_length *x, t_symbol *s, int argc, t_atom *argv)
-{
- outlet_float(x->x_obj.ob_outlet, (t_float)argc);
-}
-static void length_any(t_length *x, t_symbol *s, int argc, t_atom *argv)
-{
- outlet_float(x->x_obj.ob_outlet, (t_float)argc+1);
-}
-
-static void *length_new(void)
-{
- t_length *x = (t_length *)pd_new(length_class);
- outlet_new(&x->x_obj, gensym("float"));
- return (x);
-}
-
-static void length_setup(void)
-{
- length_class = class_new(gensym("length"), (t_newmethod)length_new, 0,
- sizeof(t_length), 0, A_DEFFLOAT, 0);
-
- class_addlist(length_class, (t_method)length_list);
- class_addanything(length_class, (t_method)length_any);
- // class_addbang(length_class, (t_method)length_bang);
-
- class_sethelpsymbol(length_class, gensym("zexy/length"));
-}
-
-/* global setup routine */
-
-void z_stat_setup(void)
-{
- mean_setup();
- minmax_setup();
- length_setup();
-}
diff --git a/src/z_strings.c b/src/z_strings.c
deleted file mode 100644
index 7ec8d40..0000000
--- a/src/z_strings.c
+++ /dev/null
@@ -1,433 +0,0 @@
-#include "zexy.h"
-#include <stdlib.h>
-#include <string.h>
-
-#ifdef NT
-# pragma warning( disable : 4244 )
-# pragma warning( disable : 4305 )
-# define sqrtf sqrt
-# define STATIC_INLINE
-#else
-# define STATIC_INLINE static
-#endif
-
-/*
- * atoi : ascii to integer
- * strcmp : compare 2 lists as if they were strings
- * list2symbol: convert a list into a single symbol
- * symbol2list: vice versa
-*/
-
-/* atoi :: ascii to integer */
-
-static t_class *atoi_class;
-
-typedef struct _atoi
-{
- t_object x_obj;
- int i;
-} t_atoi;
-static void atoi_bang(t_atoi *x)
-{
- outlet_float(x->x_obj.ob_outlet, (t_float)x->i);
-}
-static void atoi_float(t_atoi *x, t_floatarg f)
-{
- x->i = f;
- outlet_float(x->x_obj.ob_outlet, (t_float)x->i);
-}
-static void atoi_symbol(t_atoi *x, t_symbol *s)
-{
- int base=10;
- const char* c = s->s_name;
- if(c[0]=='0'){
- base=8;
- if (c[1]=='x')base=16;
- }
- x->i=strtol(c, 0, base);
- outlet_float(x->x_obj.ob_outlet, (t_float)x->i);
-}
-static void atoi_list(t_atoi *x, t_symbol *s, int argc, t_atom *argv)
-{
- int base=10;
- const char* c;
-
- if (argv->a_type==A_FLOAT){
- x->i=atom_getfloat(argv);
- outlet_float(x->x_obj.ob_outlet, (t_float)x->i);
- return;
- }
-
- if (argc>1){
- base=atom_getfloat(argv+1);
- if (base<2) {
- error("atoi: setting base to 10");
- base=10;
- }
- }
- c=atom_getsymbol(argv)->s_name;
- x->i=strtol(c, 0, base);
- outlet_float(x->x_obj.ob_outlet, (t_float)x->i);
-}
-
-static void *atoi_new(void)
-{
- t_atoi *x = (t_atoi *)pd_new(atoi_class);
- outlet_new(&x->x_obj, gensym("float"));
- return (x);
-}
-
-static void atoi_setup(void)
-{
- atoi_class = class_new(gensym("atoi"), (t_newmethod)atoi_new, 0,
- sizeof(t_atoi), 0, A_DEFFLOAT, 0);
-
- class_addbang(atoi_class, (t_method)atoi_bang);
- class_addfloat(atoi_class, (t_method)atoi_float);
- class_addlist(atoi_class, (t_method)atoi_list);
- class_addsymbol(atoi_class, (t_method)atoi_symbol);
- class_addanything(atoi_class, (t_method)atoi_symbol);
-
- class_sethelpsymbol(atoi_class, gensym("zexy/atoi"));
-}
-
-/* ------------------------- strcmp ------------------------------- */
-
-/* compare 2 lists ( == for lists) */
-
-static t_class *strcmp_class;
-
-typedef struct _strcmp
-{
- t_object x_obj;
-
- t_binbuf *bbuf1, *bbuf2;
-} t_strcmp;
-
-static void strcmp_bang(t_strcmp *x)
-{
- char *str1=0, *str2=0;
- int n1=0, n2=0;
- int result = 0;
-
- binbuf_gettext(x->bbuf1, &str1, &n1);
- binbuf_gettext(x->bbuf2, &str2, &n2);
-
- result = strcmp(str1, str2);
-
- freebytes(str1, n1);
- freebytes(str2, n2);
-
- outlet_float(x->x_obj.ob_outlet, result);
-}
-
-static void strcmp_secondlist(t_strcmp *x, t_symbol *s, int argc, t_atom *argv)
-{
- binbuf_clear(x->bbuf2);
- binbuf_add(x->bbuf2, argc, argv);
-}
-
-static void strcmp_list(t_strcmp *x, t_symbol *s, int argc, t_atom *argv)
-{
- binbuf_clear(x->bbuf1);
- binbuf_add(x->bbuf1, argc, argv);
-
- strcmp_bang(x);
-}
-
-static void *strcmp_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_strcmp *x = (t_strcmp *)pd_new(strcmp_class);
-
- outlet_new(&x->x_obj, 0);
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("list"), gensym("lst2"));
-
- x->bbuf1 = binbuf_new();
- x->bbuf2 = binbuf_new();
-
-
- strcmp_secondlist(x, gensym("list"), argc, argv);
-
- return (x);
-}
-
-static void strcmp_free(t_strcmp *x)
-{
- binbuf_free(x->bbuf1);
- binbuf_free(x->bbuf2);
-}
-
-
-static void strcmp_setup(void)
-{
- strcmp_class = class_new(gensym("strcmp"), (t_newmethod)strcmp_new,
- (t_method)strcmp_free, sizeof(t_strcmp), 0, A_GIMME, 0);
-
- class_addbang (strcmp_class, strcmp_bang);
- class_addlist (strcmp_class, strcmp_list);
- class_addmethod (strcmp_class, (t_method)strcmp_secondlist, gensym("lst2"), A_GIMME, 0);
-
- class_sethelpsymbol(strcmp_class, gensym("zexy/strcmp"));
-}
-
-/* ------------------------- list2symbol ------------------------------- */
-
-static t_class *list2symbol_class;
-
-typedef struct _list2symbol
-{
- t_object x_obj;
- int ac;
- t_atom *ap;
- t_symbol *s,*connector;
-} t_list2symbol;
-
-static void list2symbol_connector(t_list2symbol *x, t_symbol *s){
- x->connector = s;
-}
-
-static void list2symbol_bang(t_list2symbol *x)
-{
- t_atom *argv=x->ap;
- int argc=x->ac;
- char *result = 0;
- int length = 0, len=0;
- int i= argc;
- char *connector=0;
- char connlen=0;
- if(x->connector)connector=x->connector->s_name;
- if(connector)connlen=strlen(connector);
-
- /* 1st get the length of the symbol */
- if(x->s)length+=strlen(x->s->s_name);
- else length-=connlen;
-
- length+=i*connlen;
-
- while(i--){
- char buffer[MAXPDSTRING];
- atom_string(argv++, buffer, MAXPDSTRING);
- length+=strlen(buffer);
- }
-
- if (length<0){
- outlet_symbol(x->x_obj.ob_outlet, gensym(""));
- return;
- }
-
- result = (char*)getbytes((length+1)*sizeof(char));
-
- /* 2nd create the symbol */
- if (x->s){
- char *buf = x->s->s_name;
- strcpy(result+len, buf);
- len+=strlen(buf);
- if(i && connector){
- strcpy(result+len, connector);
- len += connlen;
- }
- }
- i=argc;
- argv=x->ap;
- while(i--){
- char buffer[MAXPDSTRING];
- atom_string(argv++, buffer, MAXPDSTRING);
- strcpy(result+len, buffer);
- len += strlen(buffer);
- if(i && connector){
- strcpy(result+len, connector);
- len += connlen;
- }
- }
- result[length]=0;
- outlet_symbol(x->x_obj.ob_outlet, gensym(result));
- freebytes(result, (length+1)*sizeof(char));
-}
-
-static void list2symbol_anything(t_list2symbol *x, t_symbol *s, int argc, t_atom *argv)
-{
- x->s =s;
- x->ac=argc;
- x->ap=argv;
-
- list2symbol_bang(x);
-}
-
-static void list2symbol_list(t_list2symbol *x, t_symbol *s, int argc, t_atom *argv)
-{
- list2symbol_anything(x, 0, argc, argv);
-}
-static void *list2symbol_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_list2symbol *x = (t_list2symbol *)pd_new(list2symbol_class);
-
- outlet_new(&x->x_obj, 0);
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("symbol"), gensym(""));
- x->connector = gensym(" ");
- list2symbol_anything(x, 0, argc, argv);
-
- return (x);
-}
-
-static void list2symbol_free(t_list2symbol *x)
-{}
-
-
-static void list2symbol_setup(void)
-{
- list2symbol_class = class_new(gensym("list2symbol"), (t_newmethod)list2symbol_new,
- (t_method)list2symbol_free, sizeof(t_list2symbol), 0, A_GIMME, 0);
-
- class_addcreator((t_newmethod)list2symbol_new, gensym("l2s"), A_GIMME, 0);
- class_addbang (list2symbol_class, list2symbol_bang);
- class_addlist (list2symbol_class, list2symbol_list);
- class_addanything(list2symbol_class, list2symbol_anything);
- class_addmethod (list2symbol_class, (t_method)list2symbol_connector, gensym(""), A_SYMBOL, 0);
-
- class_sethelpsymbol(list2symbol_class, gensym("zexy/list2symbol"));
-}
-
-/* ------------------------- symbol2list ------------------------------- */
-
-static t_class *symbol2list_class;
-
-typedef struct _symbol2list
-{
- t_object x_obj;
- t_symbol *s, *delimiter;
- t_atom *argv;
- int argc, argnum; /* "argnum" is the number of reserved atoms (might be >argc) */
-} t_symbol2list;
-
-static void symbol2list_delimiter(t_symbol2list *x, t_symbol *s){
- x->delimiter = s;
-}
-
-STATIC_INLINE void string2atom(t_atom *ap, char* cp, int clen){
- char *buffer=getbytes(sizeof(char)*(clen+1));
- char *endptr[1];
- t_float ftest;
- strncpy(buffer, cp, clen);
- buffer[clen]=0;
- // post("converting buffer '%s' %d", buffer, clen);
- ftest=strtod(buffer, endptr);
- if (*endptr == buffer){
- /* strtof() failed, we have a symbol */
- SETSYMBOL(ap, gensym(buffer));
- } else {
- /* it is a number. */
- SETFLOAT(ap,ftest);
- }
- freebytes(buffer, sizeof(char)*(clen+1));
-}
-static void symbol2list_process(t_symbol2list *x)
-{
- char *cc;
- char *deli;
- int dell;
- char *cp, *d;
- int i=1;
-
- if (x->s==NULL){
- x->argc=0;
- return;
- }
- cc=x->s->s_name;
- cp=cc;
-
- if (x->delimiter==NULL || x->delimiter==&s_){
- i=strlen(cc);
- if(x->argnum<i){
- freebytes(x->argv, x->argnum*sizeof(t_atom));
- x->argnum=i+10;
- x->argv=getbytes(x->argnum*sizeof(t_atom));
- }
- x->argc=i;
- while(i--)string2atom(x->argv+i, cc+i, 1);
- return;
- }
-
- deli=x->delimiter->s_name;
- dell=strlen(deli);
-
-
- /* get the number of tokens */
- while((d=strstr(cp, deli))){
- if (d!=NULL && d!=cp){
- i++;
- }
- cp=d+dell;
- }
-
- /* resize the list-buffer if necessary */
- if(x->argnum<i){
- freebytes(x->argv, x->argnum*sizeof(t_atom));
- x->argnum=i+10;
- x->argv=getbytes(x->argnum*sizeof(t_atom));
- }
- x->argc=i;
- /* parse the tokens into the list-buffer */
- i=0;
-
- /* find the first token */
- cp=cc;
- while(cp==(d=strstr(cp,deli))){cp+=dell;}
- while((d=strstr(cp, deli))){
- if(d!=cp){
- string2atom(x->argv+i, cp, d-cp);
- i++;
- }
- cp=d+dell;
- }
-
- if(cp)string2atom(x->argv+i, cp, strlen(cp));
-}
-static void symbol2list_bang(t_symbol2list *x){
- symbol2list_process(x);
- if(x->argc)outlet_list(x->x_obj.ob_outlet, 0, x->argc, x->argv);
-}
-static void symbol2list_symbol(t_symbol2list *x, t_symbol *s){
- x->s = s;
- symbol2list_bang(x);
-}
-static void *symbol2list_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_symbol2list *x = (t_symbol2list *)pd_new(symbol2list_class);
-
- outlet_new(&x->x_obj, 0);
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("symbol"), gensym(""));
-
- x->argc=0;
- x->argnum=16;
- x->argv=getbytes(x->argnum*sizeof(t_atom));
- symbol2list_delimiter(x, (argc)?atom_getsymbol(argv):gensym(" "));
-
- return (x);
-}
-
-static void symbol2list_free(t_symbol2list *x)
-{
-}
-
-
-static void symbol2list_setup(void)
-{
- symbol2list_class = class_new(gensym("symbol2list"), (t_newmethod)symbol2list_new,
- (t_method)symbol2list_free, sizeof(t_symbol2list), 0, A_GIMME, 0);
-
- class_addcreator((t_newmethod)symbol2list_new, gensym("s2l"), A_GIMME, 0);
- class_addsymbol (symbol2list_class, symbol2list_symbol);
- class_addbang (symbol2list_class, symbol2list_bang);
- class_addmethod (symbol2list_class, (t_method)symbol2list_delimiter, gensym(""), A_SYMBOL, 0);
-
- class_sethelpsymbol(symbol2list_class, gensym("zexy/symbol2list"));
-}
-/* global setup routine */
-
-void z_strings_setup(void)
-{
- atoi_setup();
- strcmp_setup();
- symbol2list_setup();
- list2symbol_setup();
-}
diff --git a/src/z_swap.c b/src/z_swap.c
deleted file mode 100644
index bdf6770..0000000
--- a/src/z_swap.c
+++ /dev/null
@@ -1,262 +0,0 @@
-/*
- the long waited for swap~-object that does a byte swap
- of course, we unfortunately have to quantize the float-signal to 16bit (to get bytes)
-
- 1110:forum::für::umläute:1999
- */
-
-#include "zexy.h"
-#ifdef NT
-#pragma warning( disable : 4244 )
-#pragma warning( disable : 4305 )
-#endif
-
-/* ------------------------ swap~ ----------------------------- */
-#define FLOAT2SHORT 32768.
-#define SHORT2FLOAT 1./32768.
-
-static t_class *swap_class;
-
-typedef struct _swap
-{
- t_object x_obj;
- int swapper;
-} t_swap;
-
-static void swap_float(t_swap *x, t_floatarg f)
-{
- x->swapper = (f != 0);
-}
-
-static void swap_bang(t_swap *x)
-{
- x->swapper ^= 1;
-}
-
-static t_int *swap_perform(t_int *w)
-{
- t_swap *x = (t_swap *)(w[1]);
- t_float *in = (t_float *)(w[2]);
- t_float *out = (t_float *)(w[3]);
- int n = (int)(w[4]);
-
-
- if (x->swapper)
- while (n--) {
- short dummy = FLOAT2SHORT * *in++;
- *out++ = SHORT2FLOAT * (short)( ((dummy & 0xFF) << 8) | ((dummy & 0xFF00) >> 8) );
- }
- else while (n--) *out++ = *in++;
-
- return (w+5);
-}
-
-static void swap_dsp(t_swap *x, t_signal **sp)
-{
- dsp_add(swap_perform, 4, x, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n);
-}
-
-static void swap_helper(void)
-{
- post("\n%c swap~-object for byteswapping a signal", HEARTSYMBOL);
- post("<1/0> : turn the swapper on/off\n"
- "'bang' : toggle the swapper on/off\n"
- "'help' : view this\n"
- "signal~");
- post("outlet : signal~");
-}
-
-static void *swap_new()
-{
- t_swap *x = (t_swap *)pd_new(swap_class);
- outlet_new(&x->x_obj, gensym("signal"));
- x->swapper = 1;
- return (x);
-}
-
-void z_swaptilde_setup(void)
-{
- swap_class = class_new(gensym("swap~"), (t_newmethod)swap_new, 0,
- sizeof(t_swap), 0, A_DEFFLOAT, 0);
- class_addmethod(swap_class, nullfn, gensym("signal"), 0);
- class_addmethod(swap_class, (t_method)swap_dsp, gensym("dsp"), 0);
-
- class_addfloat(swap_class, swap_float);
- class_addbang(swap_class, swap_bang);
-
- class_addmethod(swap_class, (t_method)swap_helper, gensym("help"), 0);
- class_sethelpsymbol(swap_class, gensym("zexy/swap~"));
-}
-
-/* ------------------------ blockmirror~ ----------------------------- */
-
-/* mirrors a signalblock around it's center:
- {x[0], x[1], ... x[n-1]} --> {x[n-1], x[n-2], ... x[0]}
-*/
-
-static t_class *blockmirror_class;
-
-typedef struct _blockmirror
-{
- t_object x_obj;
- int doit;
- int blocksize;
- t_float *blockbuffer;
-} t_blockmirror;
-
-static void blockmirror_float(t_blockmirror *x, t_floatarg f)
-{
- x->doit = (f != 0);
-}
-
-static t_int *blockmirror_perform(t_int *w)
-{
- t_blockmirror *x = (t_blockmirror *)(w[1]);
- t_float *in = (t_float *)(w[2]);
- t_float *out = (t_float *)(w[3]);
- int n = (int)(w[4]);
- if (x->doit) {
- if (in==out){
- int N=n;
- t_float *dummy=x->blockbuffer;
- while(n--)*dummy++=*in++;
- dummy--;
- while(N--)*out++=*dummy--;
- } else {
- in+=n-1;
- while(n--)*out++=*in--;
- }
- } else while (n--) *out++ = *in++;
- return (w+5);
-}
-
-static void blockmirror_dsp(t_blockmirror *x, t_signal **sp)
-{
- if (x->blocksize<sp[0]->s_n){
- if(x->blockbuffer)freebytes(x->blockbuffer, sizeof(t_float)*x->blocksize);
- x->blocksize = sp[0]->s_n;
- x->blockbuffer = getbytes(sizeof(t_float)*x->blocksize);
- }
- dsp_add(blockmirror_perform, 4, x, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n);
-}
-
-static void blockmirror_helper(void)
-{
- post("\n%c blockmirror~-object for reverting a signal", HEARTSYMBOL);
- post("'help' : view this\n"
- "signal~");
- post("outlet : signal~");
-}
-
-static void *blockmirror_new()
-{
- t_blockmirror *x = (t_blockmirror *)pd_new(blockmirror_class);
- outlet_new(&x->x_obj, gensym("signal"));
- x->doit = 1;
- x->blocksize=0;
- return (x);
-}
-
-void blockmirror_setup(void)
-{
- blockmirror_class = class_new(gensym("blockmirror~"), (t_newmethod)blockmirror_new, 0,
- sizeof(t_blockmirror), 0, A_DEFFLOAT, 0);
- class_addmethod(blockmirror_class, nullfn, gensym("signal"), 0);
- class_addmethod(blockmirror_class, (t_method)blockmirror_dsp, gensym("dsp"), 0);
-
- class_addfloat(blockmirror_class, blockmirror_float);
-
- class_addmethod(blockmirror_class, (t_method)blockmirror_helper, gensym("help"), 0);
- class_sethelpsymbol(blockmirror_class, gensym("zexy/blockmirror~"));
-}
-
-/* ------------------------ blockswap~ ----------------------------- */
-
-/* swaps a signalblock around it's center:
- {x[0], x[1], ... x[n-1]} --> {x[n-1], x[n-2], ... x[0]}
-*/
-
-static t_class *blockswap_class;
-
-typedef struct _blockswap
-{
- t_object x_obj;
- int doit;
- int blocksize;
- t_float *blockbuffer;
-} t_blockswap;
-
-static void blockswap_float(t_blockswap *x, t_floatarg f)
-{
- x->doit = (f != 0);
-}
-
-static t_int *blockswap_perform(t_int *w)
-{
- t_blockswap *x = (t_blockswap *)(w[1]);
- t_float *in = (t_float *)(w[2]);
- t_float *out = (t_float *)(w[3]);
- int N = (int)(w[4]);
- int N2=N/2;
- if (x->doit) {
- int n=N2;
- t_float *dummy=x->blockbuffer;
- while(n--)*dummy++=*in++;
- n=N-N2;
- while(n--)*out++=*in++;
- dummy=x->blockbuffer;
- n=N2;
- while(n--)*out++=*dummy++;
- } else while (N--) *out++=*in++;
- return (w+5);
-}
-
-static void blockswap_dsp(t_blockswap *x, t_signal **sp)
-{
- if (x->blocksize*2<sp[0]->s_n){
- if(x->blockbuffer)freebytes(x->blockbuffer, sizeof(t_float)*x->blocksize);
- x->blocksize = sp[0]->s_n/2;
- x->blockbuffer = getbytes(sizeof(t_float)*x->blocksize);
- }
- dsp_add(blockswap_perform, 4, x, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n);
-}
-
-static void blockswap_helper(void)
-{
- post("\n%c blockswap~-object for blockwise-swapping of a signal ", HEARTSYMBOL);
- post("'help' : view this\n"
- "signal~");
- post("outlet : signal~");
-}
-
-static void *blockswap_new()
-{
- t_blockswap *x = (t_blockswap *)pd_new(blockswap_class);
- outlet_new(&x->x_obj, gensym("signal"));
- x->doit = 1;
- x->blocksize=0;
- return (x);
-}
-
-void blockswap_setup(void)
-{
- blockswap_class = class_new(gensym("blockswap~"), (t_newmethod)blockswap_new, 0,
- sizeof(t_blockswap), 0, A_DEFFLOAT, 0);
- class_addmethod(blockswap_class, nullfn, gensym("signal"), 0);
- class_addmethod(blockswap_class, (t_method)blockswap_dsp, gensym("dsp"), 0);
-
- class_addfloat(blockswap_class, blockswap_float);
-
- class_addmethod(blockswap_class, (t_method)blockswap_helper, gensym("help"), 0);
- class_sethelpsymbol(blockswap_class, gensym("zexy/blockswap~"));
-}
-
-
-/* ----------------------------------------------------------------- */
-
-void z_swap_setup(void){
- z_swaptilde_setup();
- blockswap_setup();
- blockmirror_setup();
-}
-
diff --git a/src/z_tabread4.c b/src/z_tabread4.c
deleted file mode 100644
index c04cd41..0000000
--- a/src/z_tabread4.c
+++ /dev/null
@@ -1,312 +0,0 @@
-
-/* ---------- tabread4: control, interpolating ------------------------ */
-/* hack : 2108:forum::für::umläute:1999 @ iem */
-
-#include "zexy.h"
-
-
-/* =================== tabdump ====================== */
-
-static t_class *tabdump_class;
-
-typedef struct _tabdump
-{
- t_object x_obj;
- t_symbol *x_arrayname;
- t_int startindex, stopindex;
-} t_tabdump;
-
-static void tabdump_bang(t_tabdump *x)
-{
- t_garray *A;
- int npoints;
- t_float *vec;
-
- if (!(A = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class)))
- error("%s: no such array", x->x_arrayname->s_name);
- else if (!garray_getfloatarray(A, &npoints, &vec))
- error("%s: bad template for tabdump", x->x_arrayname->s_name);
- else
- {
- int n;
- t_atom *atombuf;
-
- int start=x->startindex;
- int stop =x->stopindex;
- if(start<0||start>stop)start=0;
- if(stop<start||stop>npoints)stop=npoints;
- npoints=stop-start;
-
- atombuf = (t_atom *)getbytes(sizeof(t_atom)*npoints);
- for (n = 0; n < npoints; n++) SETFLOAT(&atombuf[n], vec[start+n]);
- outlet_list(x->x_obj.ob_outlet, &s_list, npoints, atombuf);
- freebytes(atombuf,sizeof(t_atom)*npoints);
- }
-}
-
-static void tabdump_list(t_tabdump *x, t_symbol*s,int argc, t_atom*argv)
-{
- int a,b;
- switch(argc){
- case 2:
- a=atom_getint(argv);
- b=atom_getint(argv+1);
- x->startindex=(a<b)?a:b;
- x->stopindex =(a>b)?a:b;
- tabdump_bang(x);
- break;
- default:
- error("tabdump: list must be 2 floats (is %d atoms)", argc);
- }
-}
-
-static void tabdump_set(t_tabdump *x, t_symbol *s)
-{
- x->x_arrayname = s;
-}
-
-static void *tabdump_new(t_symbol *s)
-{
- t_tabdump *x = (t_tabdump *)pd_new(tabdump_class);
- x->x_arrayname = s;
- x->startindex=0;
- x->stopindex=-1;
- outlet_new(&x->x_obj, &s_list);
-
- return (x);
-}
-
-static void tabdump_helper(void)
-{
- post("\n%c tabdump - object : dumps a table as a package of floats", HEARTSYMBOL);
- post("'set <table>'\t: read out another table\n"
- "'bang'\t\t: dump the table\n"
- "outlet\t\t: table-data as package of floats");
- post("creation\t: \"tabdump <table>\"");
-
-}
-
-static void tabdump_setup(void)
-{
- tabdump_class = class_new(gensym("tabdump"), (t_newmethod)tabdump_new,
- 0, sizeof(t_tabdump), 0, A_DEFSYM, 0);
- class_addbang(tabdump_class, (t_method)tabdump_bang);
- class_addlist(tabdump_class, (t_method)tabdump_list);
-
- class_addmethod(tabdump_class, (t_method)tabdump_set, gensym("set"),
- A_SYMBOL, 0);
-
- class_addmethod(tabdump_class, (t_method)tabdump_helper, gensym("help"), 0);
- class_sethelpsymbol(tabdump_class, gensym("zexy/tabdump"));
-}
-
-/* =================== tabminmax ====================== */
-
-static t_class *tabminmax_class;
-
-typedef struct _tabminmax
-{
- t_object x_obj;
- t_outlet*min_out, *max_out;
- t_symbol *x_arrayname;
- t_int startindex, stopindex;
-} t_tabminmax;
-
-static void tabminmax_bang(t_tabminmax *x)
-{
- t_garray *A;
- int npoints;
- t_float *vec;
-
- if (!(A = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class)))
- error("%s: no such array", x->x_arrayname->s_name);
- else if (!garray_getfloatarray(A, &npoints, &vec))
- error("%s: bad template for tabminmax", x->x_arrayname->s_name);
- else
- {
- int n;
- t_atom atombuf[2];
- t_float min, max;
- int mindex, maxdex;
-
- int start=x->startindex;
- int stop =x->stopindex;
- if(start<0||start>stop)start=0;
- if(stop<start||stop>npoints)stop=npoints;
- npoints=stop-start;
-
- min=vec[start];
- max=vec[start];
-
- mindex=start;
- maxdex=start;
-
- for (n = 1; n < npoints; n++){
- t_float val=vec[start+n];
- if(val<min){
- mindex=start+n;
- min=val;
- }
- if(val>max){
- maxdex=start+n;
- max=val;
- }
- }
-
- SETFLOAT(atombuf, max);
- SETFLOAT(atombuf+1, maxdex);
- outlet_list(x->max_out, &s_list, 2, atombuf);
-
- SETFLOAT(atombuf, min);
- SETFLOAT(atombuf+1, mindex);
- outlet_list(x->min_out, &s_list, 2, atombuf);
- }
-}
-
-static void tabminmax_list(t_tabminmax *x, t_symbol*s,int argc, t_atom*argv)
-{
- int a,b;
- switch(argc){
- case 2:
- a=atom_getint(argv);
- b=atom_getint(argv+1);
- x->startindex=(a<b)?a:b;
- x->stopindex =(a>b)?a:b;
- tabminmax_bang(x);
- break;
- default:
- error("tabminmax: list must be 2 floats (is %d atoms)", argc);
- }
-}
-
-static void tabminmax_set(t_tabminmax *x, t_symbol *s)
-{
- x->x_arrayname = s;
-}
-
-static void *tabminmax_new(t_symbol *s)
-{
- t_tabminmax *x = (t_tabminmax *)pd_new(tabminmax_class);
- x->x_arrayname = s;
- x->startindex=0;
- x->stopindex=-1;
- x->min_out=outlet_new(&x->x_obj, &s_list);
- x->max_out=outlet_new(&x->x_obj, &s_list);
-
- return (x);
-}
-
-static void tabminmax_helper(void)
-{
- post("\n%c tabminmax - object : dumps a table as a package of floats", HEARTSYMBOL);
- post("'set <table>'\t: read out another table\n"
- "'bang'\t\t: get min and max of the table\n"
- "outlet\t\t: table-data as package of floats");
- post("creation\t: \"tabminmax <table>\"");
-
-}
-
-static void tabminmax_setup(void)
-{
- tabminmax_class = class_new(gensym("tabminmax"), (t_newmethod)tabminmax_new,
- 0, sizeof(t_tabminmax), 0, A_DEFSYM, 0);
- class_addbang(tabminmax_class, (t_method)tabminmax_bang);
- class_addlist(tabminmax_class, (t_method)tabminmax_list);
-
- class_addmethod(tabminmax_class, (t_method)tabminmax_set, gensym("set"),
- A_SYMBOL, 0);
-
- class_addmethod(tabminmax_class, (t_method)tabminmax_helper, gensym("help"), 0);
- class_sethelpsymbol(tabminmax_class, gensym("zexy/tabminmax"));
-}
-
-
-/* =================== tabset ====================== */
-
-static t_class *tabset_class;
-
-typedef struct _tabset
-{
- t_object x_obj;
- t_symbol *x_arrayname;
-} t_tabset;
-
-static void tabset_float(t_tabset *x, t_floatarg f)
-{
- t_garray *A;
- int npoints;
- t_float *vec;
-
- if (!(A = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class)))
- error("%s: no such array", x->x_arrayname->s_name);
- else if (!garray_getfloatarray(A, &npoints, &vec))
- error("%s: bad template for tabset", x->x_arrayname->s_name);
- else {
- while(npoints--)*vec++=f;
- garray_redraw(A);
- }
-}
-
-static void tabset_list(t_tabset *x, t_symbol *s, int argc, t_atom* argv)
-{
- t_garray *A;
- int npoints;
- t_float *vec;
-
- if (!(A = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class)))
- error("%s: no such array", x->x_arrayname->s_name);
- else if (!garray_getfloatarray(A, &npoints, &vec))
- error("%s: bad template for tabset", x->x_arrayname->s_name);
- else {
- if (argc>=npoints)
- while(npoints--)*vec++=atom_getfloat(argv++);
- else {
- npoints-=argc;
- while (argc--)*vec++=atom_getfloat(argv++);
- while (npoints--)*vec++=0;
- }
- garray_redraw(A);
- }
-}
-static void tabset_set(t_tabset *x, t_symbol *s)
-{
- x->x_arrayname = s;
-}
-
-static void *tabset_new(t_symbol *s)
-{
- t_tabset *x = (t_tabset *)pd_new(tabset_class);
- x->x_arrayname = s;
-
- return (x);
-}
-
-static void tabset_helper(void)
-{
- post("\n%c tabset - object : set a table with a package of floats", HEARTSYMBOL);
- post("'set <table>'\t: set another table\n"
- "<list>\t\t: set the table"
- "<float>\t\t: set the table to constant float\n");
- post("creation\t: \"tabset <table>\"");
-}
-
-static void tabset_setup(void)
-{
- tabset_class = class_new(gensym("tabset"), (t_newmethod)tabset_new,
- 0, sizeof(t_tabset), 0, A_DEFSYM, 0);
- class_addfloat(tabset_class, (t_method)tabset_float);
- class_addlist (tabset_class, (t_method)tabset_list);
- class_addmethod(tabset_class, (t_method)tabset_set, gensym("set"),
- A_SYMBOL, 0);
-
- class_addmethod(tabset_class, (t_method)tabset_helper, gensym("help"), 0);
- class_sethelpsymbol(tabset_class, gensym("zexy/tabset"));
-}
-
-
-void z_tabread4_setup(void)
-{
- tabdump_setup();
- tabminmax_setup();
- tabset_setup();
-}
diff --git a/src/z_zdelay.c b/src/z_tilde.c
index 1c4f1ed..7d786ca 100644
--- a/src/z_zdelay.c
+++ b/src/z_tilde.c
@@ -1,3 +1,19 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
/*
here we do some sample-wise delay, so you can do your own FIR-filter-designs
here are :: "z^(-1)", "z^(-N)"
@@ -8,11 +24,6 @@
#include "zexy.h"
-#ifdef NT
-#pragma warning( disable : 4244 )
-#pragma warning( disable : 4305 )
-#endif
-
/* ----------------------------------------------------- */
static t_class *zNdelay_class;
@@ -107,7 +118,7 @@ static void zdel_helper(void)
}
-void z_zdelay_setup(void)
+void z_tilde_setup(void)
{
zNdelay_class = class_new(gensym("z~"), (t_newmethod)zNdelay_new, (t_method)zNdelay_free,
sizeof(t_zNdelay), 0, A_DEFFLOAT, 0);
@@ -117,4 +128,5 @@ void z_zdelay_setup(void)
class_addfloat(zNdelay_class, zdel_float);
class_addmethod(zNdelay_class, (t_method)zdel_helper, gensym("help"), 0);
class_sethelpsymbol(zNdelay_class, gensym("zexy/z~"));
+ zexy_register("z~");
}
diff --git a/src/zexy.c b/src/zexy.c
index 710072a..7758b57 100644
--- a/src/zexy.c
+++ b/src/zexy.c
@@ -1,7 +1,22 @@
+/******************************************************
+ *
+ * zexy - implementation file
+ *
+ * copyleft (c) IOhannes m zmölnig
+ *
+ * 1999:forum::für::umläute:2004
+ *
+ * institute of electronic music and acoustics (iem)
+ *
+ ******************************************************
+ *
+ * license: GNU General Public License v.2
+ *
+ ******************************************************/
+
+
/* ...this is a very ZEXY external ...
so have fun
-
- 1999:forum::für::umläute:2001
*/
#include "zexy.h"
@@ -134,147 +149,18 @@ static void zexy_help(void)
"this software is under the GnuGPL that is provided with these files", HEARTSYMBOL, HEARTSYMBOL, HEARTSYMBOL, HEARTSYMBOL, HEARTSYMBOL, HEARTSYMBOL, HEARTSYMBOL, HEARTSYMBOL, HEARTSYMBOL, HEARTSYMBOL, HEARTSYMBOL, HEARTSYMBOL);
}
-void *zexy_new(void)
+static void *zexy_new(void)
{
t_zexy *x = (t_zexy *)pd_new(zexy_class);
return (void *)x;
}
-/* include some externals */
-#if 0
-void z_streamin_setup(); /* urps, i THINK this will be linux only */
-void z_streamout_setup();
-void z_stdinout_setup(); // not yet...
-#endif // 0
-void z_sfplay_setup();
-void z_sfrecord_setup();
-void z_noise_setup();
-void z_testfun_setup();
-void z_nop_setup();
-void z_zdelay_setup();
-void z_limiter_setup();
-void z_swap_setup();
-void z_quantize_setup();
-void z_sigzero_setup();
-void z_tabread4_setup();
-void z_makefilenamen_setup();
-void z_makesymbol_setup();
-
-void z_pdf_setup();
-void z_dfreq_setup();
-void z_sigaverage_setup();
-void z_sigpack_setup();
-
-void z_datetime_setup();
-
-void z_sigbin_setup();
-
-#if 0 // used to be Win32 only, but i somehow lost the fine code
-void z_execute_setup();
-#endif
-
-/* lp ports are only on i386 machines */
-#ifdef __i386__
-void z_lp_setup();
-#endif
-
-void z_index_setup();
-void z_connective_setup();
-void z_sort_setup();
-void z_multiplex_setup();
-void z_average_setup();
-void z_coordinates_setup();
-void z_stat_setup();
-
-void z_pack_setup();
-void z_drip_setup();
-
-void z_stdinout_setup();
-void z_msgfile_setup();
-void z_multiline_setup();
-void z_matrix_setup();
-void z_sigmatrix_setup();
-
-void z_strings_setup();
-
-void z_prime_setup();
-void z_random_setup();
-void z_wrap_setup();
-/*
- waiting to be released in near future:
- make stdin~ and stdout~ work
- MAKE streamin~ work !!!
- sql
- ...
-*/
-void z_operating_system_setup();
+#include "z_zexy.c"
void zexy_setup(void)
{
int i;
-#if 0
-#ifdef linux
- z_streamin_setup();
-#endif
- z_streamout_setup();
- z_stdinout_setup();
-#endif
- z_sfplay_setup();
- z_sfrecord_setup();
- z_noise_setup();
- z_testfun_setup();
- z_limiter_setup();
- z_nop_setup();
- z_zdelay_setup();
- z_swap_setup();
- z_quantize_setup();
-
- z_sigzero_setup();
- z_pdf_setup();
- z_dfreq_setup();
- z_sigaverage_setup();
- z_sigbin_setup();
-
- z_sigpack_setup();
-
- z_tabread4_setup();
- z_average_setup();
- z_coordinates_setup();
- z_stat_setup();
- z_makesymbol_setup();
-
- z_datetime_setup();
-
- z_index_setup();
- z_connective_setup();
- z_sort_setup();
- z_multiplex_setup();
- z_pack_setup();
- z_drip_setup();
-
- z_prime_setup();
- z_random_setup();
- z_wrap_setup();
-#if 0
- z_stdinout_setup();
-
- // we'll do this the next days
- z_execute_setup();
-#endif
- z_msgfile_setup();
-
- z_multiline_setup();
- z_matrix_setup();
- z_sigmatrix_setup();
-
- z_strings_setup();
- z_operating_system_setup();
-
-/* lp ports are only on i386 machines */
-#ifdef __i386__
- z_lp_setup();
-#endif
-
+ z_zexy_setup();
/* ************************************** */
startpost("\n\t");
for (i=0; i<28; i++) startpost("%c", HEARTSYMBOL);
diff --git a/src/zexy.dsp b/src/zexy.dsp
index 98c27ce..7c94124 100644
--- a/src/zexy.dsp
+++ b/src/zexy.dsp
@@ -39,7 +39,8 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEXY_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /I "..\..\..\pd\src" /D "WIN32" /D "NT" /D "_WINDOWS" /D "ZEXY" /FR /YX /FD /c
+# ADD CPP /nologo /Zp16 /W3 /GX /I "..\..\..\pd\src" /D "WIN32" /D "NT" /D "_WINDOWS" /D "ZEXY" /D "Z_WANT_LPT" /FR /YX /FD /c
+# SUBTRACT CPP /O<none>
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /win32
# SUBTRACT MTL /mktyplib203
@@ -60,147 +61,239 @@ LINK32=link.exe
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
-SOURCE=.\z_average.c
+SOURCE=.\a2l.c
# End Source File
# Begin Source File
-SOURCE=.\z_connective.c
+SOURCE=.\atoi.c
# End Source File
# Begin Source File
-SOURCE=.\z_coordinates.c
+SOURCE=.\avg_tilde.c
# End Source File
# Begin Source File
-SOURCE=.\z_datetime.c
+SOURCE=.\blockmirror_tilde.c
# End Source File
# Begin Source File
-SOURCE=.\z_dfreq.c
+SOURCE=.\blockswap_tilde.c
# End Source File
# Begin Source File
-SOURCE=.\z_drip.c
+SOURCE=.\date.c
# End Source File
# Begin Source File
-SOURCE=.\z_index.c
+SOURCE=.\demultiplex.c
# End Source File
# Begin Source File
-SOURCE=.\z_limiter.c
+SOURCE=.\demultiplex_tilde.c
# End Source File
# Begin Source File
-SOURCE=.\z_makesymbol.c
+SOURCE=.\dfreq_tilde.c
# End Source File
# Begin Source File
-SOURCE=.\z_matrix.c
+SOURCE=.\dirac_tilde.c
# End Source File
# Begin Source File
-SOURCE=.\z_msgfile.c
+SOURCE=.\dot.c
# End Source File
# Begin Source File
-SOURCE=.\z_multiline.c
+SOURCE=.\drip.c
# End Source File
# Begin Source File
-SOURCE=.\z_multiplex.c
+SOURCE=.\envrms_tilde.c
# End Source File
# Begin Source File
-SOURCE=.\z_noise.c
+SOURCE=.\glue.c
# End Source File
# Begin Source File
-SOURCE=.\z_nop.c
+SOURCE=.\index.c
# End Source File
# Begin Source File
-SOURCE=.\z_operating_system.c
+SOURCE=.\length.c
# End Source File
# Begin Source File
-SOURCE=.\z_pack.c
+SOURCE=.\limiter_tilde.c
# End Source File
# Begin Source File
-SOURCE=.\z_pdf.c
+SOURCE=.\list2int.c
# End Source File
# Begin Source File
-SOURCE=.\z_prime.c
+SOURCE=.\list2symbol.c
# End Source File
# Begin Source File
-SOURCE=.\z_quantize.c
+SOURCE=.\lister.c
# End Source File
# Begin Source File
-SOURCE=.\z_random.c
+SOURCE=.\lpt.c
# End Source File
# Begin Source File
-SOURCE=.\z_sfplay.c
+SOURCE=.\makesymbol.c
# End Source File
# Begin Source File
-SOURCE=.\z_sfrecord.c
+SOURCE=.\mavg.c
# End Source File
# Begin Source File
-SOURCE=.\z_sigaverage.c
+SOURCE=.\minmax.c
# End Source File
# Begin Source File
-SOURCE=.\z_sigbin.c
+SOURCE=.\msgfile.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\multiline_tilde.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\multiplex.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\multiplex_tilde.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\niagara.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\noish_tilde.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\noisi_tilde.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\operating_system.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\pack_tilde.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\packel.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\pdf_tilde.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\prime.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\quantize_tilde.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\repack.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\repeat.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\sfplay.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\sfrecord.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\sigzero_tilde.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\sort.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\step_tilde.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\strcmp.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\sum.c
# End Source File
# Begin Source File
-SOURCE=.\z_sigmatrix.c
+SOURCE=.\swap_tilde.c
# End Source File
# Begin Source File
-SOURCE=.\z_sigpack.c
+SOURCE=.\symbol2list.c
# End Source File
# Begin Source File
-SOURCE=.\z_sigzero.c
+SOURCE=.\tabdump.c
# End Source File
# Begin Source File
-SOURCE=.\z_sort.c
+SOURCE=.\tabminmax.c
# End Source File
# Begin Source File
-SOURCE=.\z_stat.c
+SOURCE=.\tabset.c
# End Source File
# Begin Source File
-SOURCE=.\z_strings.c
+SOURCE=.\tavg_tilde.c
# End Source File
# Begin Source File
-SOURCE=.\z_swap.c
+SOURCE=.\time.c
# End Source File
# Begin Source File
-SOURCE=.\z_tabread4.c
+SOURCE=.\unpack_tilde.c
# End Source File
# Begin Source File
-SOURCE=.\z_testfun.c
+SOURCE=.\urn.c
# End Source File
# Begin Source File
-SOURCE=.\z_wrap.c
+SOURCE=.\winNT_portio.c
# End Source File
# Begin Source File
-SOURCE=.\z_zdelay.c
+SOURCE=.\wrap.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\z_sigbin.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\z_tilde.c
# End Source File
# Begin Source File
@@ -219,5 +312,13 @@ SOURCE=..\..\src\m_pd.h
SOURCE=.\Zexy.h
# End Source File
# End Group
+# Begin Group "generic"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\z_zexy.h
+# End Source File
+# End Group
# End Target
# End Project
diff --git a/src/zexy.h b/src/zexy.h
index bd41ed6..7d6a2cb 100644
--- a/src/zexy.h
+++ b/src/zexy.h
@@ -32,14 +32,44 @@
#include "m_pd.h"
-#define VERSION "1.3"
+#define VERSION "2.0"
#ifdef NT
-/* yes, we have beautiful hearts under NT */
-#define HEARTSYMBOL 3
+# pragma warning( disable : 4244 )
+# pragma warning( disable : 4305 )
+# define HEARTSYMBOL 3
+# define sqrtf sqrt
+# define fabsf fabs
+# define STATIC_INLINE
#else
-/* but none for linux; indeed the only drawback */
-#define HEARTSYMBOL 169
+# define HEARTSYMBOL 169
#endif
+#ifdef MACOSX
+# define sqrtf sqrt
#endif
+
+
+typedef struct _mypdlist
+{
+ t_object x_obj;
+
+ int x_n;
+ t_atom *x_list;
+} t_mypdlist;
+
+#ifdef SINGLE_EXTERNALS
+static void zexy_register(char*object){
+ if(object!=0){
+ post("%s: part of the zexy external "VERSION"", object);
+ post("\t (l) forum::für::umläute");
+ post("\t IOhannes m zmölnig @ IEM");
+ post("\t compiled: "__DATE__" ");
+ }
+}
+#else
+static void zexy_register(char*object){}
+#endif /* SINGLE_EXTERNALS */
+
+
+#endif /* INCLUDE_ZEXY_H__ */