diff options
author | IOhannes m zmölnig <zmoelnig@users.sourceforge.net> | 2011-11-17 15:58:09 +0000 |
---|---|---|
committer | IOhannes m zmölnig <zmoelnig@users.sourceforge.net> | 2011-11-17 15:58:09 +0000 |
commit | c71d145c01d5d988d4da2c86c315660ce371f5ca (patch) | |
tree | 75b9a83ae5bc4dd6ab026484e97a52329fdba1cf /src | |
parent | 11f0ceb4a45c4cb299acd499603cf477f279da24 (diff) |
more liberal use of 'error'
svn path=/trunk/externals/iem/iemmatrix/; revision=15786
Diffstat (limited to 'src')
-rw-r--r-- | src/mtx_max2.c | 2 | ||||
-rw-r--r-- | src/mtx_min2.c | 2 | ||||
-rw-r--r-- | src/mtx_mul.c | 38 |
3 files changed, 21 insertions, 21 deletions
diff --git a/src/mtx_max2.c b/src/mtx_max2.c index 60b87b5..27da1f3 100644 --- a/src/mtx_max2.c +++ b/src/mtx_max2.c @@ -99,7 +99,7 @@ static void mtx_max2_float(t_mtx_binmtx *x, t_float f) t_atom *ap, *ap2=m2->atombuffer+2; int row2, col2, n; - if (!m2->atombuffer){ post("mulitply with what ?"); return; } + if (!m2->atombuffer){ pd_error(x, "right-hand matrix is missing"); return; } row2=atom_getfloat(m2->atombuffer); col2=atom_getfloat(m2->atombuffer+1); diff --git a/src/mtx_min2.c b/src/mtx_min2.c index 5bf0db3..846cd31 100644 --- a/src/mtx_min2.c +++ b/src/mtx_min2.c @@ -99,7 +99,7 @@ static void mtx_min2_float(t_mtx_binmtx *x, t_float f) t_atom *ap, *ap2=m2->atombuffer+2; int row2, col2, n; - if (!m2->atombuffer){ post("mulitply with what ?"); return; } + if (!m2->atombuffer){ pd_error(x, "right-hand matrix is missing"); return; } row2=atom_getfloat(m2->atombuffer); col2=atom_getfloat(m2->atombuffer+1); diff --git a/src/mtx_mul.c b/src/mtx_mul.c index e509d41..aa97aa5 100644 --- a/src/mtx_mul.c +++ b/src/mtx_mul.c @@ -34,15 +34,15 @@ static void mtx_mul_matrix(t_mtx_binmtx *x, t_symbol *s, int argc, t_atom *argv) int row=atom_getfloat(argv), col=atom_getfloat(argv+1); int row2, col2, n, r, c; - if (!m2->atombuffer){ post("mulitply with what ?"); return; } - if (argc<2){ post("mtx_mul: crippled matrix"); return; } - if ((col<1)||(row<1)){post("mtx_mul: invalid dimensions"); return; } - if (col*row>argc-2){ post("sparse matrix not yet supported : use \"mtx_check\""); return; } + if (!m2->atombuffer){ pd_error(x, "right-hand matrix is missing"); return; } + if (argc<2){ pd_error(x, "crippled matrix"); return; } + if ((col<1)||(row<1)){pd_error(x, "invalid dimensions"); return; } + if (col*row>argc-2){ pd_error(x, "sparse matrix not yet supported : use \"mtx_check\""); return; } row2=atom_getfloat(m2->atombuffer); col2=atom_getfloat(m2->atombuffer+1); - if (col!=row2) { post("mtx_mul: matrix dimensions do not match !"); return; } + if (col!=row2) { pd_error(x, "matrix dimensions do not match !"); return; } adjustsize(m, row, col2); ap=m->atombuffer+2; @@ -62,7 +62,7 @@ static void mtx_mul_float(t_mtx_binmtx *x, t_float f) t_atom *ap, *ap2=m2->atombuffer+2; int row2, col2, n; - if (!m2->atombuffer){ post("mulitply with what ?"); return; } + if (!m2->atombuffer){ pd_error(x, "right-hand matrix is missing"); return; } row2=atom_getfloat(m2->atombuffer); col2=atom_getfloat(m2->atombuffer+1); @@ -87,16 +87,16 @@ static void mtx_mulelement_matrix(t_mtx_binmtx *x, t_symbol *s, int argc, t_atom t_atom *m2 = x->m2.atombuffer+2; int n = argc-2; - if (argc<2){ post("mtx_mul: crippled matrix"); return; } - if ((col<1)||(row<1)) { post("mtx_mul: invalid dimensions"); return; } - if (col*row>argc-2){ post("sparse matrix not yet supported : use \"mtx_check\""); return; } + if (argc<2){ pd_error(x, "crippled matrix"); return; } + if ((col<1)||(row<1)) { pd_error(x, "invalid dimensions"); return; } + if (col*row>argc-2){ pd_error(x, "sparse matrix not yet supported : use \"mtx_check\""); return; } if (!(x->m2.col*x->m2.row)) { adjustsize(&x->m, row, col); matrix_set(&x->m, 0); outlet_anything(x->x_obj.ob_outlet, gensym("matrix"), argc, x->m.atombuffer); return; } - if ((col!=x->m2.col)||(row!=x->m2.row)){ post("matrix dimension do not match"); /* LATER SOLVE THIS */ return; } + if ((col!=x->m2.col)||(row!=x->m2.row)){ pd_error(x, "matrix dimension do not match"); /* LATER SOLVE THIS */ return; } adjustsize(&x->m, row, col); m = x->m.atombuffer+2; @@ -119,7 +119,7 @@ static void mtx_mulscalar_matrix(t_mtx_binscalar *x, t_symbol *s, int argc, t_at int col=atom_getfloat(argv++); if (argc<2){ - post("mtx_mul: crippled matrix"); + pd_error(x, "crippled matrix"); return; } adjustsize(&x->m, row, col); @@ -149,7 +149,7 @@ static void mtx_mulscalar_list(t_mtx_binscalar *x, t_symbol *s, int argc, t_atom static void *mtx_mul_new(t_symbol *s, int argc, t_atom *argv) { - if (argc>1) post("mtx_mul : extra arguments ignored"); + if (argc>1) error("[%s]: extra arguments ignored", s->s_name); if (argc) { t_mtx_binscalar *x = (t_mtx_binscalar *)pd_new(mtx_mulscalar_class); floatinlet_new(&x->x_obj, &x->f); @@ -215,16 +215,16 @@ static void mtx_divelement_matrix(t_mtx_binmtx *x, t_symbol *s, int argc, t_atom t_atom *m2 = x->m2.atombuffer+2; int n = argc-2; - if (argc<2){ post("mtx_div: crippled matrix"); return; } - if ((col<1)||(row<1)) { post("mtx_div: invalid dimensions"); return; } - if (col*row>argc-2){ post("sparse matrix not yet supported : use \"mtx_check\""); return; } + if (argc<2){ pd_error(x, "crippled matrix"); return; } + if ((col<1)||(row<1)) { pd_error(x, "invalid dimensions"); return; } + if (col*row>argc-2){ pd_error(x, "sparse matrix not yet supported : use \"mtx_check\""); return; } if (!(x->m2.col*x->m2.row)) { adjustsize(&x->m, row, col); matrix_set(&x->m, 0); outlet_anything(x->x_obj.ob_outlet, gensym("matrix"), argc, x->m.atombuffer); return; } - if ((col!=x->m2.col)||(row!=x->m2.row)){ post("matrix dimension do not match"); /* LATER SOLVE THIS */ return; } + if ((col!=x->m2.col)||(row!=x->m2.row)){ pd_error(x, "matrix dimension do not match"); /* LATER SOLVE THIS */ return; } adjustsize(&x->m, row, col); m = x->m.atombuffer+2; @@ -243,7 +243,7 @@ static void mtx_divelement_float(t_mtx_binmtx *x, t_float f) t_atom *ap, *ap2=m2->atombuffer+2; int row2, col2, n; - if (!m2->atombuffer){ post("divide by what ?"); return; } + if (!m2->atombuffer){ pd_error(x, "right-hand matrix missing"); return; } row2=atom_getfloat(m2->atombuffer); col2=atom_getfloat(m2->atombuffer+1); @@ -268,7 +268,7 @@ static void mtx_divscalar_matrix(t_mtx_binscalar *x, t_symbol *s, int argc, t_at int col=atom_getfloat(argv++); if (argc<2){ - post("mtx_div: crippled matrix"); + pd_error(x, "crippled matrix"); return; } adjustsize(&x->m, row, col); @@ -300,7 +300,7 @@ static void mtx_divscalar_list(t_mtx_binscalar *x, t_symbol *s, int argc, t_atom static void *mtx_div_new(t_symbol *s, int argc, t_atom *argv) { - if (argc>1) post("mtx_div : extra arguments ignored"); + if (argc>1) error("[%s] extra arguments ignored", s->s_name); if (argc) { /* scalar division */ t_mtx_binscalar *x = (t_mtx_binscalar *)pd_new(mtx_divscalar_class); |