aboutsummaryrefslogtreecommitdiff
path: root/shared/common
diff options
context:
space:
mode:
Diffstat (limited to 'shared/common')
-rw-r--r--shared/common/port.c67
1 files changed, 56 insertions, 11 deletions
diff --git a/shared/common/port.c b/shared/common/port.c
index 9c08802..87f770e 100644
--- a/shared/common/port.c
+++ b/shared/common/port.c
@@ -89,6 +89,7 @@ static t_symbol *portps_outlet;
static t_symbol *portps_vtable;
static t_symbol *portps_coll;
static t_symbol *portps_funbuff;
+static t_symbol *portps_prob;
static t_symbol *portps_picture;
static t_int port_getint(t_port *x, int ndx)
@@ -509,6 +510,12 @@ static int imaction_N1_funbuff(t_port *x, char *arg)
return (PORT_NEXT);
}
+static int imaction_N1_prob(t_port *x, char *arg)
+{
+ import_emstart(x, portps_prob, &s_, 0);
+ return (PORT_NEXT);
+}
+
static int imaction_N1_picture(t_port *x, char *arg)
{
import_emstart(x, portps_picture, 0, 0);
@@ -583,6 +590,16 @@ static int imaction_P6_funbuff(t_port *x, char *arg)
return (PORT_NEXT);
}
+static int imaction_P6_prob(t_port *x, char *arg)
+{
+ binbuf_addv(x->x_outbb, "ssffs;",
+ gensym("#X"), gensym("obj"),
+ port_getx(x, 2), port_gety(x, 3), portps_prob);
+ import_emflush(x, portps_prob, &s_);
+ x->x_nobj++;
+ return (PORT_NEXT);
+}
+
/* LATER use hammer replacements */
static int imaction_P6_pack(t_port *x, char *arg)
{
@@ -755,7 +772,12 @@ static int imaction_P1_connect(t_port *x, char *arg)
static int imaction_T1_int(t_port *x, char *arg)
{
- import_emcopy(x, portps_coll);
+ if (x->x_emstate == portps_coll)
+ import_emcopy(x, portps_coll);
+ else if (x->x_emstate == portps_prob)
+ import_emcopy(x, portps_prob);
+ else
+ import_unexpected(x);
return (PORT_NEXT);
}
@@ -767,16 +789,34 @@ static int imaction_T1_flags(t_port *x, char *arg)
static int imaction_T1_set(t_port *x, char *arg)
{
- /* FIXME funbuff */
- if (import_emcopy(x, portps_vtable))
+ if (x->x_emstate == portps_vtable)
{
- int count = port_getint(x, 2);
- if (count != x->x_emcount)
- loud_warning(0, "import",
- "[%d] bad vtable chunk index %d (%d already taken)",
- x->x_messcount, count, x->x_emcount);
- x->x_emcount += x->x_inatoms - 3;
+ if (import_emcopy(x, portps_vtable))
+ {
+ int count = port_getint(x, 2);
+ if (count != x->x_emcount)
+ loud_warning(0, "import",
+ "[%d] bad vtable chunk index %d (%d already taken)",
+ x->x_messcount, count, x->x_emcount);
+ x->x_emcount += x->x_inatoms - 3;
+ }
}
+ else if (x->x_emstate == portps_funbuff)
+ import_emcopy(x, portps_funbuff);
+ else
+ import_unexpected(x);
+ return (PORT_NEXT);
+}
+
+static int imaction_T1_reset(t_port *x, char *arg)
+{
+ import_emcopy(x, portps_prob);
+ return (PORT_NEXT);
+}
+
+static int imaction_T1_embed(t_port *x, char *arg)
+{
+ import_emcopy(x, portps_prob);
return (PORT_NEXT);
}
@@ -861,6 +901,7 @@ static t_portslot imslots__N[] =
{ "vtable", imaction_N1_vtable, 0, 0, 0 },
{ "coll", imaction_N1_coll, 0, 0, 0 },
{ "funbuff", imaction_N1_funbuff, 0, 0, 0 },
+ { "prob", imaction_N1_prob, 0, 0, 0 },
{ "picture", imaction_N1_picture, 0, 0, 0 }
};
static t_portnode imnode__N = { imslots__N, PORT_NSLOTS(imslots__N), 1 };
@@ -871,7 +912,8 @@ static t_portslot imslots_newobj[] =
{ "p", imaction_P6_patcher, 0, 0, 0 },
{ "table", imaction_P6_table, 0, 0, 0 },
{ "coll", imaction_P6_coll, 0, 0, 0 },
- { "funbuff", imaction_P6_funbuff, 0, 0, 0 }
+ { "funbuff", imaction_P6_funbuff, 0, 0, 0 },
+ { "prob", imaction_P6_prob, 0, 0, 0 }
};
static t_portnode imnode_newobj = { imslots_newobj,
PORT_NSLOTS(imslots_newobj), 6 };
@@ -963,7 +1005,9 @@ static t_portslot imslots__T[] =
{
{ "int", imaction_T1_int, 0, 0, 0 },
{ "flags", imaction_T1_flags, 0, 0, 0 },
- { "set", imaction_T1_set, 0, 0, 0 }
+ { "set", imaction_T1_set, 0, 0, 0 },
+ { "reset", imaction_T1_reset, 0, 0, 0 },
+ { "embed", imaction_T1_embed, 0, 0, 0 }
};
static t_portnode imnode__T = { imslots__T, PORT_NSLOTS(imslots__T), 1 };
@@ -1292,6 +1336,7 @@ static void port_checksetup(void)
portps_vtable = gensym("vtable");
portps_coll = gensym("coll");
portps_funbuff = gensym("funbuff");
+ portps_prob = gensym("prob");
portps_picture = gensym("picture");
if (zgetfn(&pd_objectmaker, portps_bogus) == 0)