Update of /cvsroot/pure-data/externals/iem/iemmatrix/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27585
Modified Files: mtx_matrix.c Log Message: i added a "size" command to the base object that resizes the matrix atombuffer silently (no output), or shows the matrix dimensions. [size r c(, [size r(, and [size( are allowed, making a rectangular or square matrix, or answering with the size of the matrix, respectively.
Index: mtx_matrix.c =================================================================== RCS file: /cvsroot/pure-data/externals/iem/iemmatrix/src/mtx_matrix.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** mtx_matrix.c 25 Jul 2006 14:13:28 -0000 1.6 --- mtx_matrix.c 9 Aug 2006 16:16:12 -0000 1.7 *************** *** 164,167 **** --- 164,188 ---- }
+ void matrix_size(t_matrix *x, t_symbol *s, int argc, t_atom *argv) + { + int col, row, size=x->row*x->col; + + switch(argc) { + case 0: /* size */ + outlet_list(x->x_obj.ob_outlet, gensym("size"), 2, x->atombuffer); + break; + case 1: + row=atom_getfloat(argv); + adjustsize(x, row, row); + matrix_set(x, 0); + break; + default: + row=atom_getfloat(argv++); + col=atom_getfloat(argv); + adjustsize(x, row, col); + matrix_set(x, 0); + } + } + void matrix_zeros(t_matrix *x, t_symbol *s, int argc, t_atom *argv) { *************** *** 583,586 **** --- 604,608 ----
/* the basics : functions for creation */ + class_addmethod (matrix_class, (t_method)matrix_size, gensym("size"), A_GIMME, 0); class_addmethod (matrix_class, (t_method)matrix_eye, gensym("eye"), A_GIMME, 0); class_addmethod (matrix_class, (t_method)matrix_diag, gensym("diag"), A_GIMME, 0);