aboutsummaryrefslogtreecommitdiff
path: root/cyclone/hammer
diff options
context:
space:
mode:
Diffstat (limited to 'cyclone/hammer')
-rw-r--r--cyclone/hammer/coll.c4
-rw-r--r--cyclone/hammer/funbuff.c2
-rw-r--r--cyclone/hammer/hammer.c19
-rw-r--r--cyclone/hammer/mtr.c6
-rw-r--r--cyclone/hammer/seq.c4
-rw-r--r--cyclone/hammer/zl.c60
6 files changed, 52 insertions, 43 deletions
diff --git a/cyclone/hammer/coll.c b/cyclone/hammer/coll.c
index c4a3388..3d9aa68 100644
--- a/cyclone/hammer/coll.c
+++ b/cyclone/hammer/coll.c
@@ -1373,7 +1373,7 @@ static void coll_read(t_coll *x, t_symbol *s)
if (s && s != &s_)
collcommon_doread(cc, s, x->x_canvas);
else
- hammerpanel_open(cc->c_filehandle);
+ hammerpanel_open(cc->c_filehandle, 0);
}
static void coll_write(t_coll *x, t_symbol *s)
@@ -1391,7 +1391,7 @@ static void coll_readagain(t_coll *x)
if (cc->c_filename)
collcommon_doread(cc, 0, 0);
else
- hammerpanel_open(cc->c_filehandle);
+ hammerpanel_open(cc->c_filehandle, 0);
}
static void coll_writeagain(t_coll *x)
diff --git a/cyclone/hammer/funbuff.c b/cyclone/hammer/funbuff.c
index 8d9d698..5791b1e 100644
--- a/cyclone/hammer/funbuff.c
+++ b/cyclone/hammer/funbuff.c
@@ -260,7 +260,7 @@ static void funbuff_read(t_funbuff *x, t_symbol *s)
if (s && s != &s_)
funbuff_doread(x, s);
else
- hammerpanel_open(x->x_filehandle);
+ hammerpanel_open(x->x_filehandle, 0);
}
/* CHECKED symbol arg not allowed --
diff --git a/cyclone/hammer/hammer.c b/cyclone/hammer/hammer.c
index a4d7efe..3c4f3c2 100644
--- a/cyclone/hammer/hammer.c
+++ b/cyclone/hammer/hammer.c
@@ -27,21 +27,24 @@ static void hammer_readhook(t_pd *z, t_symbol *fn, int ac, t_atom *av)
import_max(fn->s_name, "");
}
-static void hammer_import(t_hammer *x, t_symbol *fn, t_symbol *dir)
+static void hammer_doimport(t_hammer *x, t_symbol *fn, t_symbol *dir)
{
+ if (!dir || dir == &s_) dir = x->x_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);
+ hammerpanel_open(x->x_filehandle, dir);
}
static void hammer_click(t_hammer *x, t_floatarg xpos, t_floatarg ypos,
- t_floatarg shift, t_floatarg ctrl, t_floatarg alt)
+ t_floatarg shift, t_floatarg ctrl, t_floatarg alt)
+{
+ hammer_doimport(x, 0, 0);
+}
+
+static void hammer_import(t_hammer *x, t_symbol *fn)
{
- hammer_import(x, 0, 0);
+ hammer_doimport(x, fn, 0);
}
static void hammer_bang(t_hammer *x)
@@ -82,7 +85,7 @@ void hammer_setup(void)
sizeof(t_hammer), 0, A_DEFSYM, 0);
class_addbang(hammer_class, hammer_bang);
class_addmethod(hammer_class, (t_method)hammer_import,
- gensym("import"), A_DEFSYM, A_DEFSYM, 0);
+ gensym("import"), A_DEFSYM, 0);
class_addmethod(hammer_class, (t_method)hammer_click,
gensym("click"),
A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0);
diff --git a/cyclone/hammer/mtr.c b/cyclone/hammer/mtr.c
index edc5e20..ecc80d3 100644
--- a/cyclone/hammer/mtr.c
+++ b/cyclone/hammer/mtr.c
@@ -321,7 +321,7 @@ static void mtrack_read(t_mtrack *tp, t_symbol *s)
if (s && s != &s_)
mtr_doread(tp->tr_owner, tp, s);
else /* CHECKED no default */
- hammerpanel_open(tp->tr_filehandle);
+ hammerpanel_open(tp->tr_filehandle, 0);
}
static void mtrack_write(t_mtrack *tp, t_symbol *s)
@@ -553,7 +553,7 @@ static void mtr_doread(t_mtr *x, t_mtrack *target, t_symbol *fname)
{
/* CHECKED no complaint, open dialog not presented... */
/* LATER rethink */
- hammerpanel_open(target ? target->tr_filehandle : x->x_filehandle);
+ hammerpanel_open(target ? target->tr_filehandle : x->x_filehandle, 0);
}
}
@@ -672,7 +672,7 @@ static void mtr_read(t_mtr *x, t_symbol *s)
if (s && s != &s_)
mtr_doread(x, 0, s);
else /* CHECKED no default */
- hammerpanel_open(x->x_filehandle);
+ hammerpanel_open(x->x_filehandle, 0);
}
static void mtr_write(t_mtr *x, t_symbol *s)
diff --git a/cyclone/hammer/seq.c b/cyclone/hammer/seq.c
index 5997d31..011c97d 100644
--- a/cyclone/hammer/seq.c
+++ b/cyclone/hammer/seq.c
@@ -782,7 +782,7 @@ static void seq_textread(t_seq *x, char *path)
if (binbuf_read(bb, path, "", 0))
{
/* CHECKED no complaint, open dialog presented */
- hammerpanel_open(x->x_filehandle); /* LATER rethink */
+ hammerpanel_open(x->x_filehandle, 0); /* LATER rethink */
}
else
{
@@ -872,7 +872,7 @@ static void seq_read(t_seq *x, t_symbol *s)
if (s && s != &s_)
seq_doread(x, s, 0);
else /* CHECKED no default */
- hammerpanel_open(x->x_filehandle);
+ hammerpanel_open(x->x_filehandle, 0);
}
static void seq_write(t_seq *x, t_symbol *s)
diff --git a/cyclone/hammer/zl.c b/cyclone/hammer/zl.c
index 566c18e..59e8f84 100644
--- a/cyclone/hammer/zl.c
+++ b/cyclone/hammer/zl.c
@@ -7,6 +7,7 @@
#include "common/loud.h"
#include "common/grow.h"
+/* CHECKME bang behaviour (every mode) */
/* LATER test reentrancy, tune speedwise */
#define ZL_DEBUG
@@ -20,7 +21,7 @@ struct _zl;
typedef int (*t_zlintargfn)(struct _zl *, int);
typedef void (*t_zlanyargfn)(struct _zl *, t_symbol *, int, t_atom *);
typedef int (*t_zlnatomsfn)(struct _zl *);
-typedef void (*t_zldoitfn)(struct _zl *, int, t_atom *);
+typedef void (*t_zldoitfn)(struct _zl *, int, t_atom *, int);
static int zl_nmodes = 0;
static t_symbol *zl_modesym[ZL_MAXMODES];
@@ -255,7 +256,7 @@ static int zl_nop_count(t_zl *x)
return (0);
}
-static void zl_nop(t_zl *x, int natoms, t_atom *buf)
+static void zl_nop(t_zl *x, int natoms, t_atom *buf, int banged)
{
loud_warning((t_pd *)x, "unknown mode");
}
@@ -270,7 +271,7 @@ static int zl_ecils_count(t_zl *x)
return (x->x_entered ? -1 : 0);
}
-static void zl_ecils(t_zl *x, int natoms, t_atom *buf)
+static void zl_ecils(t_zl *x, int natoms, t_atom *buf, int banged)
{
int cnt1, cnt2 = x->x_modearg;
natoms = x->x_inbuf1.d_natoms;
@@ -296,7 +297,7 @@ static int zl_group_count(t_zl *x)
return (x->x_entered ? -1 : 0);
}
-static void zl_group(t_zl *x, int natoms, t_atom *buf)
+static void zl_group(t_zl *x, int natoms, t_atom *buf, int banged)
{
int cnt = x->x_modearg;
if (cnt > 0)
@@ -312,6 +313,11 @@ static void zl_group(t_zl *x, int natoms, t_atom *buf)
x->x_inbuf1.d_natoms = natoms;
while (natoms--) *buf++ = *from++;
}
+ if (banged && x->x_inbuf1.d_natoms)
+ {
+ zl_output(x, x->x_inbuf1.d_natoms, buf);
+ x->x_inbuf1.d_natoms = 0;
+ }
}
else x->x_inbuf1.d_natoms = 0; /* CHECKED */
}
@@ -329,7 +335,7 @@ static int zl_iter_count(t_zl *x)
: 0);
}
-static void zl_iter(t_zl *x, int natoms, t_atom *buf)
+static void zl_iter(t_zl *x, int natoms, t_atom *buf, int banged)
{
int nremaining = x->x_inbuf1.d_natoms;
t_atom *ptr = x->x_inbuf1.d_buf;
@@ -361,7 +367,7 @@ static int zl_join_count(t_zl *x)
return (x->x_inbuf1.d_natoms + x->x_inbuf2.d_natoms);
}
-static void zl_join(t_zl *x, int natoms, t_atom *buf)
+static void zl_join(t_zl *x, int natoms, t_atom *buf, int banged)
{
if (buf)
{
@@ -379,9 +385,11 @@ static int zl_len_count(t_zl *x)
return (0);
}
-static void zl_len(t_zl *x, int natoms, t_atom *buf)
+static void zl_len(t_zl *x, int natoms, t_atom *buf, int banged)
{
- outlet_float(((t_object *)x)->ob_outlet, x->x_inbuf1.d_natoms);
+/* CHECKED 'mode len, bang'->[zl]->[print] crashes max 4.0.7... */
+ if (!banged) /* CHECKED bang is a nop in len mode */
+ outlet_float(((t_object *)x)->ob_outlet, x->x_inbuf1.d_natoms);
}
static int zl_nth_intarg(t_zl *x, int i)
@@ -408,7 +416,7 @@ static int zl_nth_count(t_zl *x)
else return (-1);
}
-static void zl_nth(t_zl *x, int natoms, t_atom *buf)
+static void zl_nth(t_zl *x, int natoms, t_atom *buf, int banged)
{
int ac1 = x->x_inbuf1.d_natoms,
ndx = x->x_modearg - 1; /* CHECKED one-based */
@@ -462,7 +470,7 @@ static int zl_reg_count(t_zl *x)
return (x->x_entered ? x->x_inbuf1.d_natoms : 0);
}
-static void zl_reg(t_zl *x, int natoms, t_atom *buf)
+static void zl_reg(t_zl *x, int natoms, t_atom *buf, int banged)
{
if (buf) memcpy(buf, x->x_inbuf1.d_buf, natoms * sizeof(*buf));
else
@@ -480,7 +488,7 @@ static int zl_rev_count(t_zl *x)
return (x->x_inbuf1.d_natoms);
}
-static void zl_rev(t_zl *x, int natoms, t_atom *buf)
+static void zl_rev(t_zl *x, int natoms, t_atom *buf, int banged)
{
if (buf)
{
@@ -501,7 +509,7 @@ static int zl_rot_count(t_zl *x)
return (x->x_inbuf1.d_natoms);
}
-static void zl_rot(t_zl *x, int natoms, t_atom *buf)
+static void zl_rot(t_zl *x, int natoms, t_atom *buf, int banged)
{
if (buf)
{
@@ -554,7 +562,7 @@ static int zl_sect_count(t_zl *x)
}
/* CHECKED in-buffer duplicates are skipped */
-static void zl_sect(t_zl *x, int natoms, t_atom *buf)
+static void zl_sect(t_zl *x, int natoms, t_atom *buf, int banged)
{
if (buf)
{
@@ -591,7 +599,7 @@ static int zl_slice_count(t_zl *x)
return (x->x_entered ? -1 : 0);
}
-static void zl_slice(t_zl *x, int natoms, t_atom *buf)
+static void zl_slice(t_zl *x, int natoms, t_atom *buf, int banged)
{
int cnt1 = x->x_modearg, cnt2;
natoms = x->x_inbuf1.d_natoms;
@@ -612,7 +620,7 @@ static int zl_sub_count(t_zl *x)
return (0);
}
-static void zl_sub(t_zl *x, int natoms, t_atom *buf)
+static void zl_sub(t_zl *x, int natoms, t_atom *buf, int banged)
{
int natoms2 = x->x_inbuf2.d_natoms;
if (natoms2)
@@ -656,7 +664,7 @@ static int zl_union_count(t_zl *x)
}
/* CHECKED in-buffer duplicates not skipped */
-static void zl_union(t_zl *x, int natoms, t_atom *buf)
+static void zl_union(t_zl *x, int natoms, t_atom *buf, int banged)
{
if (buf)
{
@@ -682,7 +690,7 @@ static void zl_union(t_zl *x, int natoms, t_atom *buf)
}
}
-static void zl_doit(t_zl *x)
+static void zl_doit(t_zl *x, int banged)
{
int reentered = x->x_entered;
int prealloc = !reentered;
@@ -711,21 +719,19 @@ static void zl_doit(t_zl *x)
/* LATER consider using the stack if !prealloc && natoms <= MAXSTACK */
if (buf = (prealloc ? d->d_buf : getbytes(natoms * sizeof(*buf))))
{
- (*zl_doitfn[x->x_mode])(x, natoms, buf);
+ (*zl_doitfn[x->x_mode])(x, natoms, buf, banged);
if (buf != d->d_buf)
freebytes(buf, natoms * sizeof(*buf));
}
}
- else (*zl_doitfn[x->x_mode])(x, 0, 0);
+ else (*zl_doitfn[x->x_mode])(x, 0, 0, banged);
if (!reentered)
x->x_entered = x->x_locked = 0;
}
static void zl_bang(t_zl *x)
{
- /* CHECKED bang is a nop in len mode, LATER consider emulating this */
- /* CHECKED 'mode len, bang'->[zl]->[print] crashes max 4.0.7... */
- zl_doit(x);
+ zl_doit(x, 1);
}
static void zl_float(t_zl *x, t_float f)
@@ -737,7 +743,7 @@ static void zl_float(t_zl *x, t_float f)
else
zldata_setfloat(&x->x_inbuf1, f);
}
- zl_doit(x);
+ zl_doit(x, 0);
}
static void zl_symbol(t_zl *x, t_symbol *s)
@@ -749,7 +755,7 @@ static void zl_symbol(t_zl *x, t_symbol *s)
else
zldata_setsymbol(&x->x_inbuf1, s);
}
- zl_doit(x);
+ zl_doit(x, 0);
}
/* LATER gpointer */
@@ -763,7 +769,7 @@ static void zl_list(t_zl *x, t_symbol *s, int ac, t_atom *av)
else
zldata_setlist(&x->x_inbuf1, ac, av);
}
- zl_doit(x);
+ zl_doit(x, 0);
}
static void zl_anything(t_zl *x, t_symbol *s, int ac, t_atom *av)
@@ -775,7 +781,7 @@ static void zl_anything(t_zl *x, t_symbol *s, int ac, t_atom *av)
else
zldata_set(&x->x_inbuf1, s, ac, av);
}
- zl_doit(x);
+ zl_doit(x, 0);
}
static int zl_modeargfn(t_zl *x)
@@ -944,7 +950,7 @@ static void zl_setupallmodes(void)
zl_setupmode("nth", 0, zl_nth_intarg, zl_nth_anyarg, zl_nth_count, zl_nth);
zl_setupmode("reg", 0, 0, zl_reg_anyarg, zl_reg_count, zl_reg);
zl_setupmode("rev", 0, 0, 0, zl_rev_count, zl_rev);
- zl_setupmode("rot", /* CHECKED (refman error) */
+ zl_setupmode("rot", /* CHECKED (refman's error) */
0, zl_rot_intarg, 0, zl_rot_count, zl_rot);
zl_setupmode("sect", 0, 0, 0, zl_sect_count, zl_sect);
zl_setupmode("slice", 0, zl_slice_intarg, 0, zl_slice_count, zl_slice);