aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ViCious/cyclone/objects8
-rw-r--r--cyclone/build_counter4
-rw-r--r--cyclone/cyclone-test.exclude1
-rw-r--r--cyclone/shadow/dummies.c84
-rw-r--r--shared/common/binport.c12
-rw-r--r--shared/common/port.c119
-rw-r--r--shared/common/port.h5
7 files changed, 181 insertions, 52 deletions
diff --git a/ViCious/cyclone/objects b/ViCious/cyclone/objects
index cc9dde7..1790c79 100644
--- a/ViCious/cyclone/objects
+++ b/ViCious/cyclone/objects
@@ -207,7 +207,13 @@ SICKLE_OBJECTS = $(ALL_SICKLES) \
DUMMIES_OBJECTS = \
$(SRCDIR)\shadow\dummies.obj \
- $(SHAREDDIR)\common\loud.obj
+ $(SHAREDDIR)\common\loud.obj \
+ $(SHAREDDIR)\common\grow.obj \
+ $(SHAREDDIR)\common\binport.obj \
+ $(SHAREDDIR)\common\port.obj \
+ $(SHAREDDIR)\unstable\forky.obj \
+ $(SHAREDDIR)\unstable\fragile.obj \
+ $(SHAREDDIR)\unstable\fringe.obj
CYCLIST_OBJECTS = \
$(SHAREDDIR)\common\binport.obj
diff --git a/cyclone/build_counter b/cyclone/build_counter
index d4ff028..fa90455 100644
--- a/cyclone/build_counter
+++ b/cyclone/build_counter
@@ -1,7 +1,7 @@
#define CYCLONE_VERSION "0.1"
#define CYCLONE_RELEASE "alpha"
-#define CYCLONE_BUILD 48
+#define CYCLONE_BUILD 49
#if 0
-CYCLONE_SNAPSHOT = 0.1-alpha48
+CYCLONE_SNAPSHOT = 0.1-alpha49
#endif
diff --git a/cyclone/cyclone-test.exclude b/cyclone/cyclone-test.exclude
index 6b3cc43..282b422 100644
--- a/cyclone/cyclone-test.exclude
+++ b/cyclone/cyclone-test.exclude
@@ -1,4 +1,5 @@
*~
+*.pict
import-result.pd
import-debug.pd
temporary
diff --git a/cyclone/shadow/dummies.c b/cyclone/shadow/dummies.c
index 6555aeb..7e26e25 100644
--- a/cyclone/shadow/dummies.c
+++ b/cyclone/shadow/dummies.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2003 krzYszcz and others.
+/* Copyright (c) 2003-2004 krzYszcz and others.
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
@@ -11,17 +11,19 @@
#endif
#include "m_pd.h"
#include "common/loud.h"
+#include "common/port.h"
//#define DUMMIES_DEBUG
static t_class *ccdummies_class;
static int dummy_nclasses = 0;
+static int pending_nclasses = 0;
static t_class **dummy_classes;
static int dummy_nreps = 0;
typedef struct _dummy_slot
{
- char *s_name;
+ char *s_name; /* do not use after setup: invalid for mapped names */
int s_nins;
int s_nouts;
int s_warned;
@@ -350,12 +352,10 @@ static t_dummy_slot dummy_slots[] =
{ "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 },
{ "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 },
@@ -390,7 +390,6 @@ static t_dummy_slot dummy_slots[] =
{ "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 },
@@ -401,12 +400,9 @@ static t_dummy_slot dummy_slots[] =
{ "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 },
{ "matrixctrl", 1, 1, 0, 0 }, /* CHECKME nins, nouts */
{ "matrix~", -1, -1, 0, (t_newmethod)dummy_matrix_tilde_new },
{ "menubar", 1, 4, 0, 0 }, /* LATER parse #Xs (additional outs) */
@@ -438,33 +434,15 @@ static t_dummy_slot dummy_slots[] =
{ "pictctrl", 1, 1, 0, 0 },
{ "pictslider", 2, 2, 0, 0 }, /* CHECKME one-dimensional mode */
{ "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 */
- { "Poly", 2, 4, 0, 0 },
{ "polyin", 1, 3, 0, 0 }, /* LATER parse args for nouts */
{ "polyout", 3, 0, 0, 0 }, /* CHECKME nins */
/* LATER poly~ */
- { "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 },
- { "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 },
@@ -479,7 +457,6 @@ static t_dummy_slot dummy_slots[] =
{ "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 },
@@ -507,12 +484,43 @@ static t_dummy_slot dummy_slots[] =
{ "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 */
{ "zigzag~", 2, 4, 0, 0 },
+
+ /* mapped names (cf the structure `importmapping_default' in port.c) */
+ /* clashing dummies go first */
+ { "biquad~", 6, 1, 0, 0 },
+ { "change", 1, 3, 0, 0 },
+ { "key", 0, 3, 0, 0 },
+ { "keyup", 0, 3, 0, 0 },
+ { "line", 3, 2, 0, 0 },
+ { "poly", 2, 4, 0, 0 },
+
+ /* remaining slots define `doomed' kind of dummies */
+ { "appledvd", 1, 2, 0, 0 },
+ /* LATER glove? */
+ { "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 */
+ { "pp", 2, 2, 0, 0 }, /* CHECKME nins */
+ { "pptempo", 2, 2, 0, 0 },
+ { "pptime", 4, 4, 0, 0 },
+ { "rewire~", 1, -1, 0, (t_newmethod)dummy_rewire_tilde_new },
+ { "sndmgrin~", 0, 2, 0, 0 }, /* CHECKME */
+ { "vdp", 3, 4, 0, 0 },
+ { "vst~", -1, -1, 0, (t_newmethod)dummy_vst_tilde_new },
{ "_dummy", 0, 0, 0, 0 }
};
@@ -575,6 +583,7 @@ static void ccdummies_reps(t_pd *x)
{
if (!dummy_classes[i])
{
+ /* name field is valid here (reps are never mapped) */
int l = 1 + strlen(sl->s_name);
if ((len += l) > 66)
{
@@ -593,7 +602,9 @@ static void ccdummies_reps(t_pd *x)
void dummies_setup(void)
{
t_dummy_slot *sl;
- int i;
+ int i, mapsize;
+ char **mapping = import_getmapping(&mapsize);
+ int ndoomed = 0;
dummy_nclasses = sizeof(dummy_slots)/sizeof(*dummy_slots);
/* never freed: */
dummy_classes = getbytes(dummy_nclasses * sizeof(*dummy_classes));
@@ -601,6 +612,15 @@ void dummies_setup(void)
{
int fd;
char dirbuf[MAXPDSTRING], *nameptr;
+ char *name = port_usemapping(sl->s_name, mapsize, mapping);
+ if (name)
+ ndoomed++;
+ else if (ndoomed && i < dummy_nclasses - 1)
+ {
+ bug("dummies_setup");
+ post("(\"%s\": clashing or doomed dummy not registered for import)",
+ sl->s_name);
+ }
if ((fd = open_via_path("", sl->s_name, ".pd",
dirbuf, &nameptr, MAXPDSTRING, 0)) >= 0)
{
@@ -608,11 +628,13 @@ void dummies_setup(void)
dummy_nreps++;
}
else
+ {
dummy_classes[i] =
- class_new(gensym(sl->s_name),
+ class_new((name ? gensym(name) : 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/shared/common/binport.c b/shared/common/binport.c
index 90eb4a1..e2c9d34 100644
--- a/shared/common/binport.c
+++ b/shared/common/binport.c
@@ -245,12 +245,12 @@ static int binport_readfloat(FILE *fp, float *fptr)
}
else if (ex || hi || lo)
{
- double d;
+ double dhi, dlo, dabs;
ex -= 0x401e;
- hi = ((hi - 0x7fffffff) - 1) + ((float)0x7fffffff + 1.);
- lo = ((lo - 0x7fffffff) - 1) + ((float)0x7fffffff + 1.);
- d = ldexp(hi, ex) + ldexp(lo, ex - 32);
- *fptr = ((word[0] & 0x80) ? -(float)d : (float)d);
+ dhi = (double)((hi - 0x7fffffff) - 1) + ((float)0x7fffffff + 1.);
+ dlo = (double)((lo - 0x7fffffff) - 1) + ((float)0x7fffffff + 1.);
+ dabs = ldexp(dhi, ex) + ldexp(dlo, ex - 32);
+ *fptr = ((word[0] & 0x80) ? -(float)dabs : (float)dabs);
}
else *fptr = 0.;
#ifdef BINPORT_DEBUG
@@ -679,7 +679,7 @@ static int maxtext_nextatom(FILE *fp, t_atom *ap)
else if (floatstate == 2)
binport_setint(ap, atoi(buf));
else if (floatstate == 4 || floatstate == 5 || floatstate == 8)
- binport_setfloat(ap, atof(buf));
+ binport_setfloat(ap, (float)atof(buf));
else
binport_setsymbol(ap, gensym(buf));
}
diff --git a/shared/common/port.c b/shared/common/port.c
index 87f770e..5ea4dcd 100644
--- a/shared/common/port.c
+++ b/shared/common/port.c
@@ -92,6 +92,83 @@ static t_symbol *portps_funbuff;
static t_symbol *portps_prob;
static t_symbol *portps_picture;
+static char *import_defmapping[] =
+{
+ /* clashing clones */
+ "append", "Append",
+ "b", "bangbang",
+ "clip", "Clip",
+ "clip~", "Clip~",
+ "line~", "Line~",
+ "scope~", "Scope~",
+ "snapshot~", "Snapshot~",
+
+ /* clashing dummies */
+ "biquad~", "Biquad~",
+ "change", "Change",
+ "key", "Key",
+ "keyup", "Keyup",
+ "line", "Line",
+ "poly", "Poly",
+
+ /* doomed dummies */
+ "appledvd", "c74.appledvd",
+ "plugconfig", "c74.plugconfig",
+ "plugin~", "c74.plugin~",
+ "plugmidiin", "c74.plugmidiin",
+ "plugmidiout", "c74.plugmidiout",
+ "plugmod", "c74.plugmod",
+ "plugmorph", "c74.plugmorph",
+ "plugmultiparam", "c74.plugmultiparam",
+ "plugout~", "c74.plugout~",
+ "plugphasor~", "c74.plugphasor~",
+ "plugreceive~", "c74.plugreceive~",
+ "plugsend~", "c74.plugsend~",
+ "plugstore", "c74.plugstore",
+ "plugsync~", "c74.plugsync~",
+ "pp", "c74.pp",
+ "pptempo", "c74.pptempo",
+ "pptime", "c74.pptime",
+ "rewire~", "c74.rewire~",
+ "sndmgrin~", "c74.sndmgrin~",
+ "vdp", "c74.vdp",
+ "vst~", "c74.vst~"
+};
+
+static int import_mapsize = 0;
+static char **import_mapping = 0;
+
+static void import_setdefmapping(void)
+{
+ import_mapsize = sizeof(import_defmapping)/(2 * sizeof(*import_defmapping));
+ import_mapping = import_defmapping;
+}
+
+void import_setmapping(int size, char **mapping)
+{
+ import_mapsize = size;
+ import_mapping = mapping;
+}
+
+char **import_getmapping(int *sizep)
+{
+ if (!import_mapping) import_setdefmapping();
+ *sizep = import_mapsize;
+ return (import_mapping);
+}
+
+char *port_usemapping(char *from, int mapsize, char **mapping)
+{
+ while (mapsize--)
+ {
+ if (strcmp(*mapping, from))
+ mapping += 2;
+ else
+ return (mapping[1]);
+ }
+ return (0);
+}
+
static t_int port_getint(t_port *x, int ndx)
{
if (ndx < x->x_inatoms)
@@ -392,10 +469,30 @@ static void import_addclassname(t_port *x, char *outname, t_atom *inatom)
SETSYMBOL(&at, gensym(outname));
else
{
+ t_symbol *insym = 0;
if (inatom->a_type == A_SYMBOL)
{
/* LATER bash inatom to lowercase (CHECKME first) */
- t_symbol *insym = inatom->a_w.w_symbol;
+ insym = inatom->a_w.w_symbol;
+ if (import_mapping && import_mapsize)
+ {
+ char **fromp = import_mapping, **top = import_mapping + 1;
+ int cnt = import_mapsize;
+ while (cnt--)
+ {
+ if (strcmp(*fromp, insym->s_name))
+ {
+ fromp += 2;
+ top += 2;
+ }
+ else
+ {
+ insym = gensym(*top);
+ inatom = 0;
+ break;
+ }
+ }
+ }
if (insym != &s_bang && insym != &s_float &&
insym != &s_symbol && insym != &s_list &&
(insym == portps_inlet || insym == portps_outlet ||
@@ -406,7 +503,15 @@ static void import_addclassname(t_port *x, char *outname, t_atom *inatom)
binbuf_add(x->x_outbb, 1, &at);
}
}
- import_copyatoms(&at, inatom, 1);
+ if (inatom)
+ import_copyatoms(&at, inatom, 1);
+ else if (insym)
+ SETSYMBOL(&at, insym);
+ else
+ {
+ bug("import_addclassname");
+ SETSYMBOL(&at, gensym("???"));
+ }
}
binbuf_add(x->x_outbb, 1, &at);
}
@@ -921,17 +1026,8 @@ static t_portnode imnode_newobj = { imslots_newobj,
/* LATER consider merging newobj and newex */
static t_portslot imslots_newex[] =
{
- { "append", import_objarg, "Append", 0, 0 },
- { "biquad~", import_objarg, "Biquad~", 0, 0 },
- { "change", import_objarg, "Change", 0, 0 },
- { "clip", import_objarg, "Clip", 0, 0 },
- { "clip~", import_objarg, "Clip~", 0, 0 },
{ "key", import_obj, "Key", 0, 0 },
{ "keyup", import_obj, "Keyup", 0, 0 },
- { "line", import_objarg, "Line", 0, 0 },
- { "line~", import_objarg, "Line~", 0, 0 },
- { "poly", import_objarg, "Poly", 0, 0 },
- { "snapshot~", import_objarg, "Snapshot~", 0, 0 },
{ "pack", imaction_P6_pack, 0, 0, 0 },
{ "unpack", imaction_P6_pack, 0, 0, 0 },
@@ -1124,6 +1220,7 @@ static void port_dochecksetup(t_portnode *node)
if (subtree)
port_dochecksetup(subtree);
}
+ import_setdefmapping();
}
#define BOGUS_NINLETS 23
diff --git a/shared/common/port.h b/shared/common/port.h
index 5d2c118..2053c20 100644
--- a/shared/common/port.h
+++ b/shared/common/port.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2003 krzYszcz and others.
+/* Copyright (c) 2003-2004 krzYszcz and others.
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
@@ -6,5 +6,8 @@
#define __PORT_H__
void import_max(char *fn, char *dir);
+void import_setmapping(int size, char **mapping);
+char **import_getmapping(int *sizep);
+char *port_usemapping(char *from, int mapsize, char **mapping);
#endif