diff options
author | Franz Zotter <fzotter@users.sourceforge.net> | 2005-09-26 07:57:02 +0000 |
---|---|---|
committer | Franz Zotter <fzotter@users.sourceforge.net> | 2005-09-26 07:57:02 +0000 |
commit | b810cd1f4f95524debe30fe8805565aedfb151a3 (patch) | |
tree | 6705811e7282cde3a8a5273301cb15765e7d7b03 /src/mtx_reverse.c | |
parent | a0c0bb9a550d0164f7d684da5e6799129898868f (diff) |
added symbolic creation arguments or mode parameters "row" "col" ["mtx"] to below described externals.
now the operation mode of these externs can be selected by arbitrary ordered creation argumens containing above symbols, or by a "mode col" etc. command. This makes it easier/more intuitive to patch without using help patches.
svn path=/trunk/externals/iem/iemmatrix/; revision=3634
Diffstat (limited to 'src/mtx_reverse.c')
-rw-r--r-- | src/mtx_reverse.c | 44 |
1 files changed, 39 insertions, 5 deletions
diff --git a/src/mtx_reverse.c b/src/mtx_reverse.c index b95d23d..825a3b2 100644 --- a/src/mtx_reverse.c +++ b/src/mtx_reverse.c @@ -16,13 +16,17 @@ #include "iemmatrix.h" static t_class *mtx_reverse_class; +static t_symbol *row_sym; +static t_symbol *col_sym; +static t_symbol *col_sym2; typedef struct _MTXreverse_ MTXreverse; struct _MTXreverse_ { t_object x_obj; int size; - int reverse_dimension; + //int reverse_dimension; + t_symbol *reverse_mode; t_outlet *list_outlet; @@ -35,7 +39,11 @@ static void deleteMTXreverse (MTXreverse *mtx_reverse_obj) if (mtx_reverse_obj->list_out) freebytes (mtx_reverse_obj->list_out, sizeof(t_atom)*(mtx_reverse_obj->size+2)); } - +static void mTXSetReverseMode (MTXreverse *mtx_reverse_obj, t_symbol *c_mode) +{ + mtx_reverse_obj->reverse_mode = c_mode; +} +/* static void mTXSetreverseDimension (MTXreverse *mtx_reverse_obj, t_float c_dim) { int dimension = (int) c_dim; @@ -43,11 +51,18 @@ static void mTXSetreverseDimension (MTXreverse *mtx_reverse_obj, t_float c_dim) dimension = (dimension < 2)?dimension:2; mtx_reverse_obj->reverse_dimension = dimension; } +*/ + static void *newMTXreverse (t_symbol *s, int argc, t_atom *argv) { MTXreverse *mtx_reverse_obj = (MTXreverse *) pd_new (mtx_reverse_class); - int c_dim = 0; + mTXSetReverseMode (mtx_reverse_obj, gensym(":")); + switch ((argc>1)?1:argc) { + case 1: + mTXSetReverseMode (mtx_reverse_obj, atom_getsymbol (argv)); + } + /*int c_dim = 0; mtx_reverse_obj->reverse_dimension = c_dim; switch ((argc>1)?1:argc) { @@ -55,7 +70,7 @@ static void *newMTXreverse (t_symbol *s, int argc, t_atom *argv) c_dim = atom_getint(argv); } mTXSetreverseDimension (mtx_reverse_obj, (t_float) c_dim); - +*/ mtx_reverse_obj->list_outlet = outlet_new (&mtx_reverse_obj->x_obj, gensym("matrix")); return ((void *) mtx_reverse_obj); } @@ -134,6 +149,20 @@ static void mTXreverseMatrix (MTXreverse *mtx_reverse_obj, t_symbol *s, // main part list_out += 2; copyList (size, argv, list_out); + + if ((mtx_reverse_obj->reverse_mode == col_sym)|| + (mtx_reverse_obj->reverse_mode == col_sym2)) { + for (count = columns; count--; list_out++) + reverseListStep (size, columns, list_out); + } + else if (mtx_reverse_obj->reverse_mode == row_sym) { + for (count = rows; count--; list_out += columns) + reverseList (columns, list_out); + } + else + reverseList (size, list_out); + +/* switch (mtx_reverse_obj->reverse_dimension) { case 2: for (count = columns; count--; list_out++) @@ -147,6 +176,7 @@ static void mTXreverseMatrix (MTXreverse *mtx_reverse_obj, t_symbol *s, reverseList (size, list_out); break; } + */ list_out = mtx_reverse_obj->list_out; @@ -167,8 +197,12 @@ void mtx_reverse_setup (void) CLASS_DEFAULT, A_GIMME, 0); class_addbang (mtx_reverse_class, (t_method) mTXreverseBang); class_addmethod (mtx_reverse_class, (t_method) mTXreverseMatrix, gensym("matrix"), A_GIMME,0); - class_addmethod (mtx_reverse_class, (t_method) mTXSetreverseDimension, gensym("dimension"), A_DEFFLOAT,0); +// class_addmethod (mtx_reverse_class, (t_method) mTXSetreverseDimension, gensym("dimension"), A_DEFFLOAT,0); + class_addmethod (mtx_reverse_class, (t_method) mTXSetReverseMode, gensym("mode"), A_DEFSYMBOL,0); class_sethelpsymbol (mtx_reverse_class, gensym("iemmatrix/mtx_reverse")); + row_sym = gensym("row"); + col_sym = gensym("col"); + col_sym2 = gensym("column"); } void iemtx_reverse_setup(void){ |