aboutsummaryrefslogtreecommitdiff
path: root/cyclone/shadow
diff options
context:
space:
mode:
Diffstat (limited to 'cyclone/shadow')
-rw-r--r--cyclone/shadow/Makefile7
-rw-r--r--cyclone/shadow/Makefile.objects9
-rw-r--r--cyclone/shadow/Makefile.sources6
-rw-r--r--cyclone/shadow/cyclone.c159
-rw-r--r--cyclone/shadow/dummies.c664
-rw-r--r--cyclone/shadow/nettles.c549
-rw-r--r--cyclone/shadow/shadow.h13
7 files changed, 1407 insertions, 0 deletions
diff --git a/cyclone/shadow/Makefile b/cyclone/shadow/Makefile
new file mode 100644
index 0000000..b700e5e
--- /dev/null
+++ b/cyclone/shadow/Makefile
@@ -0,0 +1,7 @@
+ROOT_DIR = ../..
+redefault: default $(ROOT_DIR)/bin/cyclist
+include $(ROOT_DIR)/Makefile.common
+
+$(ROOT_DIR)/bin/cyclist: $(SHARED_DIR)/common/binport.c
+ $(CC) -DBINPORT_STANDALONE -o $@ $<
+
diff --git a/cyclone/shadow/Makefile.objects b/cyclone/shadow/Makefile.objects
new file mode 100644
index 0000000..f77675c
--- /dev/null
+++ b/cyclone/shadow/Makefile.objects
@@ -0,0 +1,9 @@
+SHARED_OBJECTS = \
+common/loud.o \
+common/grow.o \
+common/binport.o \
+common/port.o \
+hammer/file.o \
+sickle/sic.o \
+unstable/fragile.o \
+unstable/loader.o
diff --git a/cyclone/shadow/Makefile.sources b/cyclone/shadow/Makefile.sources
new file mode 100644
index 0000000..8ba4681
--- /dev/null
+++ b/cyclone/shadow/Makefile.sources
@@ -0,0 +1,6 @@
+CX_SOURCES = \
+cyclone.c
+
+OTHER_SOURCES = \
+nettles.c \
+dummies.c
diff --git a/cyclone/shadow/cyclone.c b/cyclone/shadow/cyclone.c
new file mode 100644
index 0000000..047d39d
--- /dev/null
+++ b/cyclone/shadow/cyclone.c
@@ -0,0 +1,159 @@
+/* Copyright (c) 2003 krzYszcz and others.
+ * For information on usage and redistribution, and for a DISCLAIMER OF ALL
+ * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
+
+/* Never use forked calls in shadow code... */
+
+#include <stdio.h>
+#include "m_pd.h"
+#include "common/loud.h"
+#include "common/port.h"
+#include "hammer/file.h"
+#include "unstable/fragile.h"
+#include "unstable/loader.h"
+#include "shadow.h"
+#include "../build_counter"
+
+typedef struct _cyclone
+{
+ t_object x_ob;
+ t_symbol *x_dir;
+ t_hammerfile *x_filehandle;
+} t_cyclone;
+
+static t_class *cyclone_class;
+static int cyclone_hammerndx;
+static int cyclone_sicklendx;
+static int cyclone_nettlesndx;
+static int cyclone_dummiesndx;
+static int cyclone_lastndx;
+
+static void cyclone_readhook(t_pd *z, t_symbol *fn, int ac, t_atom *av)
+{
+ import_max(fn->s_name, "");
+}
+
+static void cyclone_import(t_cyclone *x, t_symbol *fn, t_symbol *dir)
+{
+ if (fn && fn != &s_)
+ {
+ if (!dir || dir == &s_) dir = x->x_dir;
+ import_max(fn->s_name, (dir && dir != &s_) ? dir->s_name : "");
+ }
+ else
+ hammerpanel_open(x->x_filehandle);
+}
+
+static void cyclone_click(t_cyclone *x, t_floatarg xpos, t_floatarg ypos,
+ t_floatarg shift, t_floatarg ctrl, t_floatarg alt)
+{
+ cyclone_import(x, 0, 0);
+}
+
+static void cyclone_bang(t_cyclone *x)
+{
+ int i;
+ fragile_class_printnames("hammer classes are: ",
+ cyclone_hammerndx, cyclone_sicklendx - 1);
+ fragile_class_printnames("sickle classes are: ",
+ cyclone_sicklendx, cyclone_nettlesndx - 1);
+ fragile_class_printnames("nettles are: ",
+ cyclone_nettlesndx, cyclone_dummiesndx - 1);
+ if (i = dummy_nreplacements())
+ post("send 'reps' message to see the list of %d \
+replacement abstractions", i);
+ else
+ post("no replacement abstractions");
+ post("send 'dummies' message to see the list of %d dummy classes",
+ /* cyclone_lastndx points to the "_dummy" sentinel class */
+ cyclone_lastndx - cyclone_dummiesndx);
+}
+
+static void cyclone_reps(t_cyclone *x)
+{
+ if (dummy_nreplacements())
+ dummy_printreplacements("replacement abstractions are: ");
+ else
+ post("no replacement abstractions");
+}
+
+static void cyclone_dummies(t_cyclone *x)
+{
+ fragile_class_printnames("dummies are: ",
+ cyclone_dummiesndx, cyclone_lastndx);
+}
+
+static void cyclone_free(t_cyclone *x)
+{
+ hammerfile_free(x->x_filehandle);
+}
+
+static void *cyclone_new(t_symbol *s)
+{
+ t_cyclone *x = (t_cyclone *)pd_new(cyclone_class);
+ x->x_filehandle = hammerfile_new((t_pd *)x, 0, cyclone_readhook, 0, 0);
+ x->x_dir = (s && s != &s_ ? s : canvas_getdir(x->x_filehandle->f_canvas));
+ return (x);
+}
+
+void cyclone_setup(void)
+{
+ int hresult, sresult;
+ hresult = sresult = LOADER_OK;
+ if (canvas_getcurrent())
+ {
+ /* Loading the library by object creation is banned, because of a danger
+ of having some of the classes already loaded. LATER rethink. */
+ loud_error(0, "apparently an attempt to create a 'cyclone' object");
+ loud_errand(0, "without having cyclone library preloaded");
+ return;
+ }
+ post("this is cyclone %s, %s %s build",
+ CYCLONE_VERSION, loud_ordinal(CYCLONE_BUILD), CYCLONE_RELEASE);
+ cyclone_class = class_new(gensym("cyclone"),
+ (t_newmethod)cyclone_new,
+ (t_method)cyclone_free,
+ sizeof(t_cyclone), 0, A_DEFSYM, 0);
+ class_addbang(cyclone_class, cyclone_bang);
+ class_addmethod(cyclone_class, (t_method)cyclone_reps,
+ gensym("reps"), 0);
+ class_addmethod(cyclone_class, (t_method)cyclone_dummies,
+ gensym("dummies"), 0);
+ class_addmethod(cyclone_class, (t_method)cyclone_import,
+ gensym("import"), A_DEFSYM, A_DEFSYM, 0);
+ class_addmethod(cyclone_class, (t_method)cyclone_click,
+ gensym("click"),
+ A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0);
+ hammerfile_setup(cyclone_class, 0);
+
+ cyclone_hammerndx = fragile_class_count();
+ if (zgetfn(&pd_objectmaker, gensym("hammer")))
+ loud_warning(0, "hammer is already loaded");
+ else
+ hresult = unstable_load_lib("", "hammer");
+
+ cyclone_sicklendx = fragile_class_count();
+ if (zgetfn(&pd_objectmaker, gensym("sickle")))
+ loud_warning(0, "sickle is already loaded");
+ else
+ sresult = unstable_load_lib("", "sickle");
+
+ cyclone_nettlesndx = fragile_class_count();
+ allnettles_setup();
+
+ cyclone_dummiesndx = fragile_class_count();
+ alldummies_setup();
+ cyclone_lastndx = fragile_class_count() - 1;
+
+ if (hresult == LOADER_NOFILE)
+ loud_error(0, "hammer library is missing");
+ else if (sresult == LOADER_NOFILE)
+ loud_error(0, "sickle library is missing");
+ else if (!zgetfn(&pd_objectmaker, gensym("hammer")) ||
+ !zgetfn(&pd_objectmaker, gensym("sickle")))
+ {
+ loud_error(0, "version mismatch");
+ loud_errand(0,
+ "use a more recent Pd release (or recompile the cyclone).");
+ }
+}
diff --git a/cyclone/shadow/dummies.c b/cyclone/shadow/dummies.c
new file mode 100644
index 0000000..272fd45
--- /dev/null
+++ b/cyclone/shadow/dummies.c
@@ -0,0 +1,664 @@
+/* Copyright (c) 2003 krzYszcz and others.
+ * For information on usage and redistribution, and for a DISCLAIMER OF ALL
+ * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
+
+#include <string.h>
+#ifdef UNIX
+#include <unistd.h>
+#endif
+#ifdef NT
+#include <io.h>
+#endif
+#include "m_pd.h"
+#include "common/loud.h"
+#include "shadow.h"
+
+static int dummy_nclasses = 0;
+static t_class **dummy_classes;
+static int dummy_nreps = 0;
+
+typedef struct _dummy_slot
+{
+ char *s_name;
+ int s_nins;
+ int s_nouts;
+ int s_warned;
+ t_newmethod s_method; /* a specialized constructor */
+} t_dummy_slot;
+
+static t_object *dummy_newobject(t_symbol *s, t_dummy_slot **slotp);
+static void dummy_io(t_object *x, int nins, int nouts);
+
+static void *dummy_2dwave_tilde_new(t_symbol *s, int ac, t_atom *av)
+{
+ t_dummy_slot *sl;
+ t_object *x = dummy_newobject(s, &sl);
+ int nouts = 0;
+ if (ac && av->a_type == A_SYMBOL)
+ {
+ if (ac > 3 && av[3].a_type == A_FLOAT)
+ nouts = (int)av[3].a_w.w_float;
+ }
+ else loud_classarg(*(t_pd *)x);
+ if (nouts < 1)
+ nouts = 1;
+ dummy_io(x, sl->s_nins, nouts);
+ return (x);
+}
+
+static void *dummy_adoutput_tilde_new(t_symbol *s, int ac, t_atom *av)
+{
+ t_dummy_slot *sl;
+ t_object *x = dummy_newobject(s, &sl);
+ int nouts = 0;
+ while (ac--)
+ {
+ if (av++->a_type == A_FLOAT) nouts++;
+ else
+ {
+ loud_classarg(*(t_pd *)x);
+ break;
+ }
+ }
+ if (nouts < 1)
+ nouts = 2;
+ dummy_io(x, sl->s_nins, nouts);
+ return (x);
+}
+
+static void *dummy_fffb_tilde_new(t_symbol *s, int ac, t_atom *av)
+{
+ t_dummy_slot *sl;
+ t_object *x = dummy_newobject(s, &sl);
+ int nouts = 0;
+ if (ac && av->a_type == A_FLOAT)
+ nouts = (int)av->a_w.w_float;
+ if (nouts < 1)
+ {
+ loud_classarg(*(t_pd *)x);
+ nouts = 1;
+ }
+ dummy_io(x, sl->s_nins, nouts);
+ return (x);
+}
+
+static void *dummy_gate_tilde_new(t_symbol *s, int ac, t_atom *av)
+{
+ t_dummy_slot *sl;
+ t_object *x = dummy_newobject(s, &sl);
+ int nouts = 0;
+ if (ac && av->a_type == A_FLOAT)
+ nouts = (int)av->a_w.w_float;
+ if (nouts < 1)
+ nouts = 1;
+ dummy_io(x, sl->s_nins, nouts);
+ return (x);
+}
+
+static void *dummy_groove_tilde_new(t_symbol *s, int ac, t_atom *av)
+{
+ t_dummy_slot *sl;
+ t_object *x = dummy_newobject(s, &sl);
+ int nouts = 0;
+ if (ac && av->a_type == A_SYMBOL)
+ {
+ if (ac > 1 && av[1].a_type == A_FLOAT)
+ nouts = (int)av[1].a_w.w_float;
+ }
+ else loud_classarg(*(t_pd *)x);
+ if (nouts < 1)
+ nouts = 1;
+ dummy_io(x, sl->s_nins, nouts + 1);
+ return (x);
+}
+
+/* FIXME */
+static void *dummy_if_new(t_symbol *s, int ac, t_atom *av)
+{
+ t_object *x = dummy_newobject(s, 0);
+ int nins = 0;
+ int nouts = 1;
+ t_symbol *ps_out2 = gensym("out2");
+ while (ac--)
+ {
+ if (av->a_type == A_SYMBOL)
+ {
+ if (av->a_w.w_symbol == ps_out2)
+ nouts = 2;
+ else
+ {
+ char *name = av->a_w.w_symbol->s_name;
+ if (strlen(name) >= 3 && *name == '$')
+ {
+ char c = name[2];
+ if (c > '1' && c <= '9' && c > '0' + nins)
+ nins = c - '0';
+ }
+ }
+ }
+ av++;
+ }
+ dummy_io(x, nins, nouts);
+ return (x);
+}
+
+static void *dummy_matrix_tilde_new(t_symbol *s, int ac, t_atom *av)
+{
+ t_dummy_slot *sl;
+ t_object *x = dummy_newobject(s, &sl);
+ int nins = 0, nouts = 0;
+ if (ac && av->a_type == A_FLOAT)
+ {
+ nins = (int)av->a_w.w_float;
+ if (ac > 1 && av[1].a_type == A_FLOAT)
+ nouts = (int)av[1].a_w.w_float;
+ }
+ if (nins < 1 || nouts < 1)
+ {
+ loud_classarg(*(t_pd *)x);
+ if (nins < 1) nins = 1;
+ if (nouts < 1) nouts = 1;
+ }
+ dummy_io(x, nins, nouts + 1); /* CHECKME */
+ return (x);
+}
+
+static void *dummy_mtr_new(t_symbol *s, int ac, t_atom *av)
+{
+ t_dummy_slot *sl;
+ t_object *x = dummy_newobject(s, &sl);
+ int nios = 0;
+ if (ac && av->a_type == A_FLOAT)
+ nios = (int)av->a_w.w_float;
+ if (nios < 1)
+ nios = 1;
+ dummy_io(x, nios + 1, nios + 1);
+ return (x);
+}
+
+/* CHECKME */
+static void *dummy_pong_tilde_new(t_symbol *s, int ac, t_atom *av)
+{
+ t_dummy_slot *sl;
+ t_object *x = dummy_newobject(s, &sl);
+ int nins = 0;
+ if (ac)
+ {
+ if (av->a_type == A_FLOAT)
+ {
+ ac--; av++;
+ if (ac)
+ {
+ if (av->a_type == A_FLOAT) nins = 3;
+ }
+ else nins = 2;
+ }
+ }
+ else nins = 2;
+ if (nins < 1)
+ {
+ loud_classarg(*(t_pd *)x);
+ nins = 2;
+ }
+ dummy_io(x, nins, sl->s_nouts);
+ return (x);
+}
+
+static void *dummy_rewire_tilde_new(t_symbol *s, int ac, t_atom *av)
+{
+ t_dummy_slot *sl;
+ t_object *x = dummy_newobject(s, &sl);
+ int nouts = 0;
+ if (ac && av->a_type == A_FLOAT)
+ nouts = (int)av->a_w.w_float;
+ else if (ac > 1 && av[1].a_type == A_FLOAT)
+ nouts = (int)av[1].a_w.w_float;
+ if (nouts < 1)
+ nouts = 1; /* CHECKME */
+ dummy_io(x, sl->s_nins, nouts + 4);
+ return (x);
+}
+
+static void *dummy_selector_tilde_new(t_symbol *s, int ac, t_atom *av)
+{
+ t_dummy_slot *sl;
+ t_object *x = dummy_newobject(s, &sl);
+ int nins = 0;
+ if (ac && av->a_type == A_FLOAT)
+ nins = (int)av->a_w.w_float;
+ if (nins < 1)
+ nins = 1;
+ dummy_io(x, nins + 1, sl->s_nouts);
+ return (x);
+}
+
+static void *dummy_sfplay_tilde_new(t_symbol *s, int ac, t_atom *av)
+{
+ t_dummy_slot *sl;
+ t_object *x = dummy_newobject(s, &sl);
+ int nouts = 0;
+ if (ac)
+ {
+ if (av->a_type == A_FLOAT)
+ nouts = (int)av->a_w.w_float;
+ else if (ac > 1 && av[1].a_type == A_FLOAT)
+ nouts = (int)av[1].a_w.w_float;
+ }
+ if (nouts < 1)
+ nouts = 1;
+ dummy_io(x, sl->s_nins, nouts + 1);
+ return (x);
+}
+
+static void *dummy_sfrecord_tilde_new(t_symbol *s, int ac, t_atom *av)
+{
+ t_dummy_slot *sl;
+ t_object *x = dummy_newobject(s, &sl);
+ int nins = 0;
+ if (ac && av->a_type == A_FLOAT)
+ nins = (int)av->a_w.w_float;
+ if (nins < 1)
+ nins = 1;
+ dummy_io(x, nins, sl->s_nouts);
+ return (x);
+}
+
+static void *dummy_stutter_tilde_new(t_symbol *s, int ac, t_atom *av)
+{
+ t_dummy_slot *sl;
+ t_object *x = dummy_newobject(s, &sl);
+ int nios = 0;
+ if (ac > 4 && av[4].a_type == A_FLOAT)
+ nios = (int)av[4].a_w.w_float;
+ if (nios < 1)
+ nios = 1;
+ dummy_io(x, nios + 2, nios);
+ return (x);
+}
+
+static void *dummy_sxformat_new(t_symbol *s, int ac, t_atom *av)
+{
+ return (dummy_if_new(s, ac, av)); /* FIXME */
+}
+
+static void *dummy_tapout_tilde_new(t_symbol *s, int ac, t_atom *av)
+{
+ t_dummy_slot *sl;
+ t_object *x = dummy_newobject(s, &sl);
+ int warned = 0, nios = 0;
+ while (ac--)
+ if (av++->a_type == A_FLOAT)
+ nios++;
+ else if (!warned++)
+ loud_classarg(*(t_pd *)x);
+ if (nios < 1)
+ nios = 1;
+ dummy_io(x, nios, nios);
+ return (x);
+}
+
+/* CHECKME */
+static void *dummy_tiCmd_new(t_symbol *s, int ac, t_atom *av)
+{
+ t_dummy_slot *sl;
+ t_object *x = dummy_newobject(s, &sl);
+ int nouts = 0;
+ if (ac > 1)
+ {
+ ac--; av++;
+ while (ac--)
+ {
+ char c = 0;
+ if (av->a_type == A_SYMBOL)
+ {
+ c = *av->a_w.w_symbol->s_name;
+ if (c == 'i' || c == 'f' || c == 'l'
+ || c == 'b' || c == 's' || c == 'a')
+ nouts++;
+ else
+ c = 0;
+ }
+ if (c == 0)
+ {
+ loud_classarg(*(t_pd *)x);
+ break;
+ }
+ av++;
+ }
+ }
+ if (nouts < 1)
+ nouts = 0;
+ dummy_io(x, sl->s_nins, nouts + 2);
+ return (x);
+}
+
+/* CHECKME */
+static void *dummy_timeline_new(t_symbol *s, int ac, t_atom *av)
+{
+ t_dummy_slot *sl;
+ t_object *x = dummy_newobject(s, &sl);
+ int nouts = 0;
+ if (ac)
+ {
+ if (av->a_type == A_FLOAT)
+ nouts = (int)av->a_w.w_float;
+ else if (ac > 1 && av[1].a_type == A_FLOAT)
+ nouts = (int)av[1].a_w.w_float;
+ }
+ if (nouts < 1)
+ nouts = 0;
+ dummy_io(x, sl->s_nins, nouts);
+ return (x);
+}
+
+static void *dummy_vexpr_new(t_symbol *s, int ac, t_atom *av)
+{
+ return (dummy_if_new(s, ac, av)); /* FIXME */
+}
+
+static void *dummy_vst_tilde_new(t_symbol *s, int ac, t_atom *av)
+{
+ t_dummy_slot *sl;
+ t_object *x = dummy_newobject(s, &sl);
+ int nins = 0, nouts = 0;
+ if (ac > 1 && av[1].a_type == A_FLOAT)
+ {
+ if (av->a_type == A_FLOAT)
+ {
+ nins = (int)av->a_w.w_float;
+ nouts = (int)av[1].a_w.w_float;
+ }
+ }
+ else if (ac && av->a_type == A_FLOAT)
+ nouts = (int)av->a_w.w_float;
+ if (nins < 1)
+ nins = 2; /* CHECKME */
+ if (nouts < 1)
+ nouts = 2; /* CHECKME */
+ dummy_io(x, nins, nouts + 4); /* CHECKME */
+ return (x);
+}
+
+static t_dummy_slot dummy_slots[] =
+{
+ { "2d.wave~", 4, -1, 0, (t_newmethod)dummy_2dwave_tilde_new },
+ { "absolutepath", 1, 1, 0, 0 },
+ { "acosh", 1, 1, 0, 0 },
+ { "adoutput~", 1, -1, 0, (t_newmethod)dummy_adoutput_tilde_new },
+ { "adstatus", 2, 2, 0, 0 },
+ { "asinh", 1, 1, 0, 0 },
+ { "atanh", 1, 1, 0, 0 },
+ { "begin~", 0, 1, 0, 0 },
+ { "Biquad~", 6, 1, 0, 0 },
+ /* LATER try mapping bpatcher to a gop abstraction/subpatch */
+ { "buffer~", 1, 2, 0, 0 },
+ { "buffir~", 3, 1, 0, 0 },
+ { "cd", 1, 2, 0, 0 }, /* CHECKED (refman error?) */
+ { "cd~", 1, 6, 0, 0 }, /* CHECKED (refman error?) */
+ { "Change", 1, 3, 0, 0 },
+ { "clocker", 2, 1, 0, 0 },
+ { "closebang", 0, 1, 0, 0 },
+ { "colorpicker", 1, 1, 0, 0 },
+ { "curve~", 3, 2, 0, 0 },
+ { "date", 1, 3, 0, 0 },
+ { "defer", 1, 1, 0, 0 }, /* LATER pass anything through */
+ { "degrade~", 3, 1, 0, 0 },
+ { "detonate", 8, 8, 0, 0 },
+ { "dial", 1, 1, 0, 0 },
+ { "dialog", 2, 1, 0, 0 },
+ { "downsamp~", 2, 1, 0, 0 },
+ { "dropfile", 1, 2, 0, 0 },
+ { "dspstate~", 1, 3, 0, 0 },
+ { "dsptime~", 1, 1, 0, 0 },
+ { "env", 1, 1, 0, 0 },
+ { "envi", 1, 1, 0, 0 },
+ { "error", 1, 1, 0, 0 },
+ { "ezadc~", 1, 2, 0, 0 },
+ { "ezdac~", 2, 0, 0, 0 },
+ { "fffb~", 1, -1, 0, (t_newmethod)dummy_fffb_tilde_new },
+ /* LATER Fft~ */
+ /* LATER pfft~-specific classes: fftin~, fftinfo~, fftout~ */
+ { "filedate", 1, 1, 0, 0 },
+ { "filein", 3, 3, 0, 0 },
+ { "filepath", 1, 1, 0, 0 },
+ { "filtergraph~", 8, 6, 0, 0 },
+ { "folder", 1, 1, 0, 0 }, /* CHECKME 2nd outlet */
+ { "follow", 1, 2, 0, 0 },
+ { "fpic", 1, 0, 0, 0 },
+ { "frame", 6, 0, 0, 0 },
+ { "function", 1, 4, 0, 0 },
+ { "gain~", 2, 2, 0, 0 },
+ { "gate~", 2, -1, 0, (t_newmethod)dummy_gate_tilde_new },
+ { "gestalt", 1, 2, 0, 0 },
+ { "Ggate", 2, 2, 0, 0 },
+ /* LATER glove? */
+ { "graphic", 1, 0, 0, 0 },
+ { "groove~", 3, -1, 0, (t_newmethod)dummy_groove_tilde_new },
+ { "Gswitch", 3, 1, 0, 0 },
+ { "hint", 1, 1, 0, 0 },
+ { "if", -1, -1, 0, (t_newmethod)dummy_if_new },
+ /* LATER Ifft~ */
+ { "imovie", 1, 3, 0, 0 },
+ { "IncDec", 1, 1, 0, 0 },
+ { "info~", 1, 8, 0, 0 }, /* CHECKME nouts */
+ { "ioscbank~", 4, 1, 0, 0 },
+ { "Key", 0, 3, 0, 0 },
+ { "Keyup", 0, 3, 0, 0 },
+ { "kslider", 2, 2, 0, 0 },
+ { "lcd", 1, 4, 0, 0 }, /* CHECKME nouts */
+ { "led", 1, 1, 0, 0 },
+ { "Line", 3, 2, 0, 0 },
+ { "lores~", 3, 1, 0, 0 },
+ { "matrixctrl", 1, 1, 0, 0 }, /* CHECKME nins, nouts */
+ { "matrix~", -1, -1, 0, (t_newmethod)dummy_matrix_tilde_new },
+ { "maximum~", 2, 1, 0, 0 },
+ { "menubar", 1, 4, 0, 0 }, /* LATER parse #Xs (additional outs) */
+ { "meter~", 1, 1, 0, 0 }, /* LATER consider mapping to the vu */
+ { "minimum~", 2, 1, 0, 0 },
+ { "movie", 1, 3, 0, 0 },
+ /* CHECKME msd */
+ { "mstosamps~", 1, 2, 0, 0 },
+ { "mtr", -1, -1, 0, (t_newmethod)dummy_mtr_new },
+ { "multiSlider", 1, 1, 0, 0 },
+ { "mute~", 1, 1, 0, 0 },
+ { "normalize~", 2, 1, 0, 0 },
+ { "number~", 2, 2, 0, 0 },
+ { "numkey", 1, 2, 0, 0 },
+ { "omscontrollers", 4, 2, 0, 0 }, /* CHECKME osx */
+ { "omsinfo", 2, 1, 0, 0 }, /* LATER midiinfo? */
+ { "omsnotes", 4, 2, 0, 0 }, /* CHECKME osx */
+ { "omspatches", 3, 2, 0, 0 }, /* CHECKME osx */
+ { "onecopy", 0, 0, 0, 0 }, /* CHECKME */
+ { "onepole~", 2, 1, 0, 0 },
+ { "opendialog", 1, 2, 0, 0 },
+ { "oscbank~", 4, 1, 0, 0 },
+ { "oval", 6, 0, 0, 0 },
+ { "overdrive~", 2, 1, 0, 0 },
+ { "panel", 1, 0, 0, 0 },
+ { "pass~", 1, 1, 0, 0 },
+ { "pcontrol", 1, 1, 0, 0 },
+ /* LATER pfft~ */
+ { "phaseshift~", 3, 1, 0, 0 },
+ { "pics", 3, 0, 0, 0 }, /* CHECKME */
+ { "pics2", 3, 0, 0, 0 }, /* CHECKME */
+ { "pict", 3, 0, 0, 0 },
+ { "pictctrl", 1, 1, 0, 0 },
+ { "pictslider", 2, 2, 0, 0 }, /* CHECKME one-dimensional mode */
+ { "pink~", 1, 1, 0, 0 }, /* CHECKME inlet */
+ { "playbar", 1, 2, 0, 0 }, /* CHECKME */
+ { "plugconfig", 1, 0, 0, 0 },
+ { "plugin~", 2, 2, 0, 0 },
+ { "plugmidiin", 0, 1, 0, 0 },
+ { "plugmidiout", 1, 0, 0, 0 },
+ { "plugmod", 5, 3, 0, 0 },
+ { "plugmorph", 2, 3, 0, 0 },
+ { "plugmultiparam", 1, 2, 0, 0 },
+ { "plugout~", 2, 2, 0, 0 }, /* CHECKME nouts */
+ { "plugphasor~", 0, 1, 0, 0 }, /* CHECKME nouts */
+ { "plugreceive~", 1, 1, 0, 0 },
+ { "plugsend~", 1, 0, 0, 0 },
+ { "plugstore", 1, 1, 0, 0 }, /* CHECKME nouts */
+ { "plugsync~", 0, 9, 0, 0 }, /* CHECKME nouts */
+ { "poke~", 3, 0, 0, 0 },
+ { "Poly", 2, 4, 0, 0 },
+ { "polyin", 1, 3, 0, 0 }, /* LATER parse args for nouts */
+ { "polyout", 3, 0, 0, 0 }, /* CHECKME nins */
+ /* LATER poly~ */
+ { "pong~", -1, 1, 0, (t_newmethod)dummy_pong_tilde_new },
+ { "pp", 2, 2, 0, 0 }, /* CHECKME nins */
+ { "pptempo", 2, 2, 0, 0 },
+ { "pptime", 4, 4, 0, 0 },
+ { "preset", 1, 3, 0, 0 },
+ { "radiogroup", 1, 1, 0, 0 },
+ { "rate~", 2, 1, 0, 0 }, /* CHECKME */
+ /* LATER settable Receive? */
+ { "rect", 6, 0, 0, 0 },
+ { "relativepath", 1, 1, 0, 0 },
+ { "reson~", 4, 1, 0, 0 },
+ { "rewire~", 1, -1, 0, (t_newmethod)dummy_rewire_tilde_new },
+ { "ring", 6, 0, 0, 0 },
+ { "round~", 2, 1, 0, 0 },
+ { "rslider", 2, 2, 0, 0 },
+ { "rtin", 1, 1, 0, 0 },
+ { "sampstoms~", 1, 2, 0, 0 },
+ { "savedialog", 1, 3, 0, 0 },
+ { "screensize", 1, 2, 0, 0 },
+ { "selector~", -1, 1, 0, (t_newmethod)dummy_selector_tilde_new },
+ { "seq~", 1, 2, 0, 0 },
+ { "serial", 1, 2, 0, 0 },
+ { "setclock", 2, 1, 0, 0 },
+ { "sfinfo~", 1, 6, 0, 0 }, /* CHECKME nouts */
+ { "sflist~", 1, 0, 0, 0 },
+ { "sfplay~", 1, -1, 0, (t_newmethod)dummy_sfplay_tilde_new },
+ { "sfrecord~", -1, 0, 0, (t_newmethod)dummy_sfrecord_tilde_new },
+ { "sndmgrin~", 0, 2, 0, 0 }, /* CHECKME */
+ { "strippath", 1, 2, 0, 0 },
+ { "stutter~", -1, -1, 0, (t_newmethod)dummy_stutter_tilde_new },
+ { "suspend", 0, 1, 0, 0 },
+ { "svf~", 3, 4, 0, 0 },
+ { "swatch", 3, 2, 0, 0 },
+ { "sxformat", -1, 1, 0, (t_newmethod)dummy_sxformat_new },
+ { "sysexin", 1, 1, 0, 0 },
+ { "Table", 2, 2, 0, 0 },
+ { "tapin~", 1, 1, 0, 0 },
+ { "tapout~", -1, -1, 0, (t_newmethod)dummy_tapout_tilde_new },
+ { "teeth~", 6, 1, 0, 0 },
+ { "tempo", 4, 1, 0, 0 },
+ { "Text", 1, 1, 0, 0 },
+ { "textedit", 1, 3, 0, 0 },
+ { "thisobject", 1, 3, 0, 0 }, /* CHECKME */
+ { "thispatcher", 1, 2, 0, 0 },
+ { "thisTimeline", 1, 1, 0, 0 },
+ { "thisTrack", 1, 0, 0, 0 },
+ { "thispoly~", 1, 1, 0, 0 },
+ { "thresh~", 3, 1, 0, 0 },
+ { "tiCmd", 0, -1, 0, (t_newmethod)dummy_tiCmd_new },
+ { "timeline", 1, -1, 0, (t_newmethod)dummy_timeline_new },
+ { "tiOut", 1, 0, 0, 0 },
+ { "timein", 3, 4, 0, 0 },
+ { "timeout", 4, 0, 0, 0 },
+ /* LATER touchin's inlet (Touchin?) */
+ { "trunc~", 1, 1, 0, 0 }, /* CHECKME */
+ { "ubutton", 1, 4, 0, 0 },
+ { "umenu", 1, 2, 0, 0 },
+ { "vdp", 3, 4, 0, 0 },
+ { "vexpr", -1, 1, 0, (t_newmethod)dummy_vexpr_new },
+ { "vpicture", 0, 0, 0, 0 },
+ { "vst~", -1, -1, 0, (t_newmethod)dummy_vst_tilde_new },
+ { "waveform~", 5, 6, 0, 0 }, /* CHECKME */
+ { "zerox~", 1, 2, 0, 0 },
+ { "zigzag~", 2, 4, 0, 0 },
+ { "_dummy", 0, 0, 0, 0 }
+};
+
+static void *dummy_new(t_symbol *s, int ac, t_atom *av)
+{
+ t_dummy_slot *sl;
+ t_object *x = dummy_newobject(s, &sl);
+ dummy_io(x, sl->s_nins, sl->s_nouts);
+ return (x);
+}
+
+static void dummy_io(t_object *x, int nins, int nouts)
+{
+ nins = (nins > 0 ? nins - 1 : 0);
+ while (nins--) inlet_new(x, (t_pd *)x, 0, 0);
+ while (nouts--) outlet_new(x, &s_anything);
+}
+
+static t_object *dummy_newobject(t_symbol *s, t_dummy_slot **slotp)
+{
+ t_object *x;
+ t_dummy_slot *sl;
+ int fnd;
+ for (fnd = 0; fnd < dummy_nclasses; fnd++)
+ /* LATER compare symbols, rather than strings */
+ if (dummy_classes[fnd] /* empty slot: abstraction replacement */
+ && !strcmp(class_getname(dummy_classes[fnd]), s->s_name))
+ break;
+ x = (t_object *)pd_new(dummy_classes[fnd]);
+ sl = &dummy_slots[fnd];
+ if (fnd == dummy_nclasses)
+ bug("dummy_newobject"); /* create a "_dummy" in this case */
+ else if (!sl->s_warned)
+ {
+ loud_warning((t_pd *)x, "dummy substitution");
+ sl->s_warned = 1;
+ }
+ if (slotp) *slotp = sl;
+ return (x);
+}
+
+int dummy_nreplacements(void)
+{
+ return (dummy_nreps);
+}
+
+void dummy_printreplacements(char *msg)
+{
+ int i, len = strlen(msg);
+ t_dummy_slot *sl;
+ startpost(msg);
+ for (i = 0, sl = dummy_slots; i < dummy_nclasses; i++, sl++)
+ {
+ if (!dummy_classes[i])
+ {
+ int l = 1 + strlen(sl->s_name);
+ if ((len += l) > 66)
+ {
+ endpost();
+ startpost(" ");
+ len = 3 + l;
+ }
+ poststring(sl->s_name);
+ }
+ }
+ endpost();
+}
+
+void alldummies_setup(void)
+{
+ t_dummy_slot *sl;
+ int i;
+ dummy_nclasses = sizeof(dummy_slots)/sizeof(*dummy_slots);
+ /* never freed: */
+ dummy_classes = getbytes(dummy_nclasses * sizeof(*dummy_classes));
+ for (i = 0, sl = dummy_slots; i < dummy_nclasses; i++, sl++)
+ {
+ int fd;
+ char dirbuf[MAXPDSTRING], *nameptr;
+ if ((fd = open_via_path("", sl->s_name, ".pd",
+ dirbuf, &nameptr, MAXPDSTRING, 0)) >= 0)
+ {
+ close(fd);
+ dummy_nreps++;
+ }
+ else
+ dummy_classes[i] =
+ class_new(gensym(sl->s_name),
+ sl->s_method ? sl->s_method : (t_newmethod)dummy_new,
+ 0, sizeof(t_object),
+ (sl->s_nins ? 0 : CLASS_NOINLET), A_GIMME, 0);
+ }
+ dummy_nclasses--; /* use "_dummy" as a sentinel */
+}
diff --git a/cyclone/shadow/nettles.c b/cyclone/shadow/nettles.c
new file mode 100644
index 0000000..d7ccb87
--- /dev/null
+++ b/cyclone/shadow/nettles.c
@@ -0,0 +1,549 @@
+/* Copyright (c) 2003 krzYszcz and others.
+ * For information on usage and redistribution, and for a DISCLAIMER OF ALL
+ * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
+
+#include <math.h>
+#include "m_pd.h"
+#include "shared.h"
+#include "sickle/sic.h"
+#include "shadow.h"
+
+#if defined(NT) || defined(MACOSX)
+/* cf pd/src/x_arithmetic.c */
+#define fmodf fmod
+#endif
+
+/* Two remaining control binops have their inputs reversed.
+ LATER think about float-to-int conversion -- there is no point in making
+ the two below compatible, while all the others are not compatible... */
+
+/* CHECKED left inlet causes output (refman's error -- a total rubbish) */
+
+typedef struct _rbinop
+{
+ t_object x_ob;
+ t_float x_f1; /* left inlet value */
+ t_float x_f2;
+} t_rbinop;
+
+static t_class *rminus_class;
+
+static void rminus_bang(t_rbinop *x)
+{
+ outlet_float(((t_object *)x)->ob_outlet, x->x_f2 - x->x_f1);
+}
+
+static void rminus_float(t_rbinop *x, t_float f)
+{
+ outlet_float(((t_object *)x)->ob_outlet, x->x_f2 - (x->x_f1 = f));
+}
+
+static void *rminus_new(t_floatarg f)
+{
+ t_rbinop *x = (t_rbinop *)pd_new(rminus_class);
+ floatinlet_new((t_object *)x, &x->x_f2); /* CHECKED */
+ outlet_new((t_object *)x, &s_float);
+ x->x_f1 = 0;
+ x->x_f2 = f; /* CHECKED */
+ return (x);
+}
+
+static t_class *rdiv_class;
+
+static void rdiv_bang(t_rbinop *x)
+{
+ if (x->x_f1 != 0.)
+ outlet_float(((t_object *)x)->ob_outlet, x->x_f2 / x->x_f1);
+ else
+ /* CHECKED int mode: nonnegative/0 == 0, negative/0 == -1,
+ float mode: positive/0 == INT_MAX, nonpositive/0 == INT_MIN
+ LATER rethink -- why is it INT_MAX, not FLT_MAX? */
+ outlet_float(((t_object *)x)->ob_outlet,
+ (x->x_f2 > 0 ? SHARED_INT_MAX : SHARED_INT_MIN));
+}
+
+static void rdiv_float(t_rbinop *x, t_float f)
+{
+ x->x_f1 = f;
+ rdiv_bang(x);
+}
+
+static void *rdiv_new(t_floatarg f)
+{
+ t_rbinop *x = (t_rbinop *)pd_new(rdiv_class);
+ floatinlet_new((t_object *)x, &x->x_f2);
+ outlet_new((t_object *)x, &s_float);
+ x->x_f1 = 0;
+ x->x_f2 = f; /* CHECKED (refman's error) */
+ return (x);
+}
+
+/* The implementation of signal relational operators below has been tuned
+ somewhat, mostly in order to get rid of costly int->float conversions.
+ Loops are not hand-unrolled, because these have proven to be slower
+ in all the tests performed so far. LATER find a good soul willing to
+ make a serious profiling research... */
+
+typedef struct _sigeq
+{
+ t_sic x_sic;
+ int x_algo;
+} t_sigeq;
+
+static t_class *sigeq_class;
+
+static t_int *sigeq_perform0(t_int *w)
+{
+ int nblock = (int)(w[1]);
+ t_float *in1 = (t_float *)(w[2]);
+ t_float *in2 = (t_float *)(w[3]);
+ t_float *out = (t_float *)(w[4]);
+ t_shared_floatint fi;
+#ifdef NETTLES_SAFE
+ int32 truebits;
+ fi.fi_f = 1.;
+ truebits = fi.fi_i;
+#endif
+ while (nblock--)
+ {
+#ifdef NETTLES_SAFE
+ fi.fi_i = ~((*in1++ == *in2++) - 1) & truebits;
+#else
+ fi.fi_i = ~((*in1++ == *in2++) - 1) & SHARED_TRUEBITS;
+#endif
+ *out++ = fi.fi_f;
+ }
+ return (w + 5);
+}
+
+static t_int *sigeq_perform1(t_int *w)
+{
+ int nblock = (int)(w[1]);
+ t_float *in1 = (t_float *)(w[2]);
+ t_float *in2 = (t_float *)(w[3]);
+ t_float *out = (t_float *)(w[4]);
+ while (nblock--) *out++ = (*in1++ == *in2++);
+ return (w + 5);
+}
+
+static t_int *sigeq_perform2(t_int *w)
+{
+ int nblock = (int)(w[1]);
+ t_float *in1 = (t_float *)(w[2]);
+ t_float *in2 = (t_float *)(w[3]);
+ t_float *out = (t_float *)(w[4]);
+ for (; nblock; nblock -= 8, in1 += 8, in2 += 8, out += 8)
+ {
+ float f0 = in1[0], f1 = in1[1], f2 = in1[2], f3 = in1[3];
+ float f4 = in1[4], f5 = in1[5], f6 = in1[6], f7 = in1[7];
+ float g0 = in2[0], g1 = in2[1], g2 = in2[2], g3 = in2[3];
+ float g4 = in2[4], g5 = in2[5], g6 = in2[6], g7 = in2[7];
+ out[0] = f0 == g0; out[1] = f1 == g1;
+ out[2] = f2 == g2; out[3] = f3 == g3;
+ out[4] = f4 == g4; out[5] = f5 == g5;
+ out[6] = f6 == g6; out[7] = f7 == g7;
+ }
+ return (w + 5);
+}
+
+static void sigeq_dsp(t_sigeq *x, t_signal **sp)
+{
+ switch (x->x_algo)
+ {
+ case 1:
+ dsp_add(sigeq_perform1, 4, sp[0]->s_n,
+ sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec);
+ break;
+ case 2:
+ dsp_add(sigeq_perform2, 4, sp[0]->s_n,
+ sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec);
+ break;
+ default:
+ dsp_add(sigeq_perform0, 4, sp[0]->s_n,
+ sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec);
+ }
+}
+
+static void sigeq__algo(t_sigeq *x, t_floatarg f)
+{
+ x->x_algo = f;
+}
+
+static void *sigeq_new(t_symbol *s, int ac, t_atom *av)
+{
+ t_sigeq *x = (t_sigeq *)pd_new(sigeq_class);
+ if (s == gensym("_==1~"))
+ x->x_algo = 1;
+ else if (s == gensym("_==2~"))
+ x->x_algo = 2;
+ else
+ x->x_algo = 0;
+ sic_inlet((t_sic *)x, 1, 0, 0, ac, av);
+ outlet_new((t_object *)x, &s_signal);
+ return (x);
+}
+
+typedef t_sic t_signeq;
+static t_class *signeq_class;
+
+static t_int *signeq_perform(t_int *w)
+{
+ int nblock = (int)(w[1]);
+ t_float *in1 = (t_float *)(w[2]);
+ t_float *in2 = (t_float *)(w[3]);
+ t_float *out = (t_float *)(w[4]);
+ t_shared_floatint fi;
+ while (nblock--)
+ {
+ fi.fi_i = ~((*in1++ != *in2++) - 1) & SHARED_TRUEBITS;
+ *out++ = fi.fi_f;
+ }
+ return (w + 5);
+}
+
+static void signeq_dsp(t_signeq *x, t_signal **sp)
+{
+ dsp_add(signeq_perform, 4, sp[0]->s_n,
+ sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec);
+}
+
+static void *signeq_new(t_symbol *s, int ac, t_atom *av)
+{
+ t_signeq *x = (t_signeq *)pd_new(signeq_class);
+ sic_inlet((t_sic *)x, 1, 0, 0, ac, av);
+ outlet_new((t_object *)x, &s_signal);
+ return (x);
+}
+
+typedef t_sic t_siglt;
+static t_class *siglt_class;
+
+static t_int *siglt_perform(t_int *w)
+{
+ int nblock = (int)(w[1]);
+ t_float *in1 = (t_float *)(w[2]);
+ t_float *in2 = (t_float *)(w[3]);
+ t_float *out = (t_float *)(w[4]);
+ t_shared_floatint fi;
+ while (nblock--)
+ {
+ fi.fi_i = ~((*in1++ < *in2++) - 1) & SHARED_TRUEBITS;
+ *out++ = fi.fi_f;
+ }
+ return (w + 5);
+}
+
+static void siglt_dsp(t_siglt *x, t_signal **sp)
+{
+ dsp_add(siglt_perform, 4, sp[0]->s_n,
+ sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec);
+}
+
+static void *siglt_new(t_symbol *s, int ac, t_atom *av)
+{
+ t_siglt *x = (t_siglt *)pd_new(siglt_class);
+ sic_inlet((t_sic *)x, 1, 0, 0, ac, av);
+ outlet_new((t_object *)x, &s_signal);
+ return (x);
+}
+
+typedef t_sic t_siggt;
+static t_class *siggt_class;
+
+static t_int *siggt_perform(t_int *w)
+{
+ int nblock = (int)(w[1]);
+ t_float *in1 = (t_float *)(w[2]);
+ t_float *in2 = (t_float *)(w[3]);
+ t_float *out = (t_float *)(w[4]);
+ t_shared_floatint fi;
+ while (nblock--)
+ {
+ fi.fi_i = ~((*in1++ > *in2++) - 1) & SHARED_TRUEBITS;
+ *out++ = fi.fi_f;
+ }
+ return (w + 5);
+}
+
+static void siggt_dsp(t_siggt *x, t_signal **sp)
+{
+ dsp_add(siggt_perform, 4, sp[0]->s_n,
+ sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec);
+}
+
+static void *siggt_new(t_symbol *s, int ac, t_atom *av)
+{
+ t_siggt *x = (t_siggt *)pd_new(siggt_class);
+ sic_inlet((t_sic *)x, 1, 0, 0, ac, av);
+ outlet_new((t_object *)x, &s_signal);
+ return (x);
+}
+
+typedef t_sic t_sigleq;
+static t_class *sigleq_class;
+
+static t_int *sigleq_perform(t_int *w)
+{
+ int nblock = (int)(w[1]);
+ t_float *in1 = (t_float *)(w[2]);
+ t_float *in2 = (t_float *)(w[3]);
+ t_float *out = (t_float *)(w[4]);
+ t_shared_floatint fi;
+ while (nblock--)
+ {
+ fi.fi_i = ~((*in1++ <= *in2++) - 1) & SHARED_TRUEBITS;
+ *out++ = fi.fi_f;
+ }
+ return (w + 5);
+}
+
+static void sigleq_dsp(t_sigleq *x, t_signal **sp)
+{
+ dsp_add(sigleq_perform, 4, sp[0]->s_n,
+ sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec);
+}
+
+static void *sigleq_new(t_symbol *s, int ac, t_atom *av)
+{
+ t_sigleq *x = (t_sigleq *)pd_new(sigleq_class);
+ sic_inlet((t_sic *)x, 1, 0, 0, ac, av);
+ outlet_new((t_object *)x, &s_signal);
+ return (x);
+}
+
+typedef t_sic t_siggeq;
+static t_class *siggeq_class;
+
+static t_int *siggeq_perform(t_int *w)
+{
+ int nblock = (int)(w[1]);
+ t_float *in1 = (t_float *)(w[2]);
+ t_float *in2 = (t_float *)(w[3]);
+ t_float *out = (t_float *)(w[4]);
+ t_shared_floatint fi;
+ while (nblock--)
+ {
+ fi.fi_i = ~((*in1++ >= *in2++) - 1) & SHARED_TRUEBITS;
+ *out++ = fi.fi_f;
+ }
+ return (w + 5);
+}
+
+static void siggeq_dsp(t_siggeq *x, t_signal **sp)
+{
+ dsp_add(siggeq_perform, 4, sp[0]->s_n,
+ sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec);
+}
+
+static void *siggeq_new(t_symbol *s, int ac, t_atom *av)
+{
+ t_siggeq *x = (t_siggeq *)pd_new(siggeq_class);
+ sic_inlet((t_sic *)x, 1, 0, 0, ac, av);
+ outlet_new((t_object *)x, &s_signal);
+ return (x);
+}
+
+typedef t_sic t_sigrminus;
+static t_class *sigrminus_class;
+
+static t_int *sigrminus_perform(t_int *w)
+{
+ int nblock = (int)(w[1]);
+ t_float *in1 = (t_float *)(w[2]);
+ t_float *in2 = (t_float *)(w[3]);
+ t_float *out = (t_float *)(w[4]);
+ while (nblock--) *out++ = *in2++ - *in1++;
+ return (w + 5);
+}
+
+static void sigrminus_dsp(t_sigrminus *x, t_signal **sp)
+{
+ dsp_add(sigrminus_perform, 4, sp[0]->s_n,
+ sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec);
+}
+
+static void *sigrminus_new(t_symbol *s, int ac, t_atom *av)
+{
+ t_sigrminus *x = (t_sigrminus *)pd_new(sigrminus_class);
+ sic_inlet((t_sic *)x, 1, 0, 0, ac, av);
+ outlet_new((t_object *)x, &s_signal);
+ return (x);
+}
+
+typedef t_sic t_sigrover;
+static t_class *sigrover_class;
+
+static t_int *sigrover_perform(t_int *w)
+{
+ int nblock = (int)(w[1]);
+ t_float *in1 = (t_float *)(w[2]);
+ t_float *in2 = (t_float *)(w[3]);
+ t_float *out = (t_float *)(w[4]);
+ while (nblock--)
+ {
+ t_float f1 = *in1++;
+ /* CHECKED incompatible: c74 outputs NaNs.
+ The line below is consistent with Pd's /~, LATER rethink. */
+ /* LATER multiply by reciprocal if in1 has no signal feeders */
+ *out++ = (f1 == 0. ? 0. : *in2++ / f1);
+ }
+ return (w + 5);
+}
+
+static void sigrover_dsp(t_sigrover *x, t_signal **sp)
+{
+ dsp_add(sigrover_perform, 4, sp[0]->s_n,
+ sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec);
+}
+
+static void *sigrover_new(t_symbol *s, int ac, t_atom *av)
+{
+ t_sigrover *x = (t_sigrover *)pd_new(sigrover_class);
+ /* CHECKED default 0 (refman's error), LATER rethink */
+ sic_inlet((t_sic *)x, 1, 0, 0, ac, av);
+ outlet_new((t_object *)x, &s_signal);
+ return (x);
+}
+
+typedef t_sic t_sigmod;
+static t_class *sigmod_class;
+
+static t_int *sigmod_perform(t_int *w)
+{
+ int nblock = (int)(w[1]);
+ t_float *in1 = (t_float *)(w[2]);
+ t_float *in2 = (t_float *)(w[3]);
+ t_float *out = (t_float *)(w[4]);
+ while (nblock--)
+ {
+ t_float f1 = *in1++;
+ t_float f2 = *in2++;
+ /* LATER think about using ieee-754 normalization tricks */
+ *out++ = (f2 == 0. ? 0. /* CHECKED */
+ : fmod(f1, f2));
+ }
+ return (w + 5);
+}
+
+static void sigmod_dsp(t_sigmod *x, t_signal **sp)
+{
+ dsp_add(sigmod_perform, 4, sp[0]->s_n,
+ sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec);
+}
+
+static void *sigmod_new(t_symbol *s, int ac, t_atom *av)
+{
+ t_sigmod *x = (t_sigmod *)pd_new(sigmod_class);
+ /* CHECKED default 0 (refman's error), LATER rethink */
+ sic_inlet((t_sic *)x, 1, 0, 0, ac, av);
+ outlet_new((t_object *)x, &s_signal);
+ return (x);
+}
+
+typedef struct _sigaccum
+{
+ t_sic x_sic;
+ t_float x_sum;
+} t_sigaccum;
+
+static t_class *sigaccum_class;
+
+static t_int *sigaccum_perform(t_int *w)
+{
+ t_sigaccum *x = (t_sigaccum *)(w[1]);
+ int nblock = (int)(w[2]);
+ t_float *in = (t_float *)(w[3]);
+ t_float *out = (t_float *)(w[4]);
+ t_float sum = x->x_sum;
+ while (nblock--) *out++ = (sum += *in++);
+ x->x_sum = sum;
+ return (w + 5);
+}
+
+static void sigaccum_dsp(t_sigaccum *x, t_signal **sp)
+{
+ dsp_add(sigaccum_perform, 4, x, sp[0]->s_n, sp[0]->s_vec, sp[1]->s_vec);
+}
+
+static void sigaccum_bang(t_sigaccum *x)
+{
+ x->x_sum = 0;
+}
+
+static void sigaccum_set(t_sigaccum *x, t_floatarg f)
+{
+ x->x_sum = f;
+}
+
+static void *sigaccum_new(t_floatarg f)
+{
+ t_sigaccum *x = (t_sigaccum *)pd_new(sigaccum_class);
+ x->x_sum = f;
+ outlet_new((t_object *)x, &s_signal);
+ return (x);
+}
+
+void allnettles_setup(void)
+{
+ rminus_class = class_new(gensym("!-"),
+ (t_newmethod)rminus_new, 0,
+ sizeof(t_rbinop), 0, A_DEFFLOAT, 0);
+ class_addbang(rminus_class, rminus_bang);
+ class_addfloat(rminus_class, rminus_float);
+ rdiv_class = class_new(gensym("!/"),
+ (t_newmethod)rdiv_new, 0,
+ sizeof(t_rbinop), 0, A_DEFFLOAT, 0);
+ class_addbang(rdiv_class, rdiv_bang);
+ class_addfloat(rdiv_class, rdiv_float);
+
+ sigeq_class = class_new(gensym("==~"),
+ (t_newmethod)sigeq_new, 0,
+ sizeof(t_sigeq), 0, A_GIMME, 0);
+ class_addcreator((t_newmethod)sigeq_new,
+ gensym("_==1~"), A_GIMME, 0);
+ class_addcreator((t_newmethod)sigeq_new,
+ gensym("_==2~"), A_GIMME, 0);
+ sic_setup(sigeq_class, sigeq_dsp, SIC_FLOATTOSIGNAL);
+ class_addmethod(sigeq_class, (t_method)sigeq__algo,
+ gensym("_algo"), A_FLOAT, 0);
+
+ signeq_class = class_new(gensym("!=~"),
+ (t_newmethod)signeq_new, 0,
+ sizeof(t_signeq), 0, A_GIMME, 0);
+ sic_setup(signeq_class, signeq_dsp, SIC_FLOATTOSIGNAL);
+ siglt_class = class_new(gensym("<~"),
+ (t_newmethod)siglt_new, 0,
+ sizeof(t_siglt), 0, A_GIMME, 0);
+ sic_setup(siglt_class, siglt_dsp, SIC_FLOATTOSIGNAL);
+ siggt_class = class_new(gensym(">~"),
+ (t_newmethod)siggt_new, 0,
+ sizeof(t_siggt), 0, A_GIMME, 0);
+ sic_setup(siggt_class, siggt_dsp, SIC_FLOATTOSIGNAL);
+ sigleq_class = class_new(gensym("<=~"),
+ (t_newmethod)sigleq_new, 0,
+ sizeof(t_sigleq), 0, A_GIMME, 0);
+ sic_setup(sigleq_class, sigleq_dsp, SIC_FLOATTOSIGNAL);
+ siggeq_class = class_new(gensym(">=~"),
+ (t_newmethod)siggeq_new, 0,
+ sizeof(t_siggeq), 0, A_GIMME, 0);
+ sic_setup(siggeq_class, siggeq_dsp, SIC_FLOATTOSIGNAL);
+ sigrminus_class = class_new(gensym("!-~"),
+ (t_newmethod)sigrminus_new, 0,
+ sizeof(t_sigrminus), 0, A_GIMME, 0);
+ sic_setup(sigrminus_class, sigrminus_dsp, SIC_FLOATTOSIGNAL);
+ sigrover_class = class_new(gensym("!/~"),
+ (t_newmethod)sigrover_new, 0,
+ sizeof(t_sigrover), 0, A_GIMME, 0);
+ sic_setup(sigrover_class, sigrover_dsp, SIC_FLOATTOSIGNAL);
+ sigmod_class = class_new(gensym("%~"),
+ (t_newmethod)sigmod_new, 0,
+ sizeof(t_sigmod), 0, A_GIMME, 0);
+ sic_setup(sigmod_class, sigmod_dsp, SIC_FLOATTOSIGNAL);
+ sigaccum_class = class_new(gensym("+=~"),
+ (t_newmethod)sigaccum_new, 0,
+ sizeof(t_sigaccum), 0, A_DEFFLOAT, 0);
+ sic_setup(sigaccum_class, sigaccum_dsp, SIC_FLOATTOSIGNAL);
+ class_addbang(sigaccum_class, sigaccum_bang);
+ class_addmethod(sigaccum_class, (t_method)sigaccum_set,
+ gensym("set"), A_FLOAT, 0);
+}
diff --git a/cyclone/shadow/shadow.h b/cyclone/shadow/shadow.h
new file mode 100644
index 0000000..aefc46e
--- /dev/null
+++ b/cyclone/shadow/shadow.h
@@ -0,0 +1,13 @@
+/* Copyright (c) 2003 krzYszcz and others.
+ * For information on usage and redistribution, and for a DISCLAIMER OF ALL
+ * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
+
+#ifndef __SHADOW_H__
+#define __SHADOW_H__
+
+void allnettles_setup(void);
+void alldummies_setup(void);
+int dummy_nreplacements(void);
+void dummy_printreplacements(char *msg);
+
+#endif