aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2005-10-24 17:06:37 +0000
committerIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2005-10-24 17:06:37 +0000
commit21ae6d6baaefe9a1d4e7a9189b6f8d9ef8cc091c (patch)
tree7410bd5530f8386ed5e9935c83be3542a1164ed6
parent3841ef753439cdf3bfcb37e54d39174cb0426f69 (diff)
make errors findable with "last error"
svn path=/trunk/externals/iem/iemmatrix/; revision=3764
-rw-r--r--src/mtx_element.c2
-rw-r--r--src/mtx_fill.c2
-rw-r--r--src/mtx_inverse.c6
-rw-r--r--src/mtx_matrix.c10
-rw-r--r--src/mtx_mul~.c4
-rw-r--r--src/mtx_resize.c2
6 files changed, 14 insertions, 12 deletions
diff --git a/src/mtx_element.c b/src/mtx_element.c
index 43b235d..2c1624e 100644
--- a/src/mtx_element.c
+++ b/src/mtx_element.c
@@ -39,7 +39,7 @@ static void mtx_element_matrix(t_matrix *x, t_symbol *s, int argc, t_atom *argv)
static void mtx_element_float(t_matrix *x, t_floatarg f)
{
if(x->current_col>x->col || x->current_row>x->row){
- error("mtx_element: element position exceeds matrix dimensions");
+ pd_error(x,"mtx_element: element position exceeds matrix dimensions");
return;
}
if(x->current_row == 0 && x->current_col == 0){
diff --git a/src/mtx_fill.c b/src/mtx_fill.c
index 400c217..d842c9e 100644
--- a/src/mtx_fill.c
+++ b/src/mtx_fill.c
@@ -162,7 +162,7 @@ static void *newMTXFill (t_symbol *s, int argc, t_atom *argv)
if (atom_getsymbol(argv)==gensym("matrix"))
mTXFillIndexMatrix (mtx_fill_obj, s, argc-1, argv+1);
else
- post("mtx_fill: creation argument must be 'matrix <startrow> <startcol>' for submatrix filling or 'matrix rows columns [...]' for indexed filling with scalar/matrices");
+ pd_error(mtx_fill_obj, "mtx_fill: creation argument must be 'matrix <startrow> <startcol>' for submatrix filling or 'matrix rows columns [...]' for indexed filling with scalar/matrices");
}
mtx_fill_obj->list_outlet = outlet_new (&mtx_fill_obj->x_obj, gensym("matrix"));
diff --git a/src/mtx_inverse.c b/src/mtx_inverse.c
index 9b8939b..f09c7b0 100644
--- a/src/mtx_inverse.c
+++ b/src/mtx_inverse.c
@@ -77,7 +77,6 @@ t_matrixfloat* mtx_doInvert(t_matrixfloat*input, int rowcol, int*error){
}
}
}
- if (ok)post("mtx_inverse: couldn't really invert the matrix !!! %d error%c", ok, (ok-1)?'s':0);
if(error!=0)*error=ok;
return inverted;
@@ -134,7 +133,10 @@ static void mtx_inverse_matrix(t_matrix *x, t_symbol *s, int argc, t_atom *argv)
/* 3b destroy the buffers */
freebytes(original, sizeof(t_matrixfloat)*row*col);
- if(error)outlet_bang(x->x_outlet);
+ if(error){
+ outlet_bang(x->x_outlet);
+ pd_error(x, "mtx_inverse: couldn't really invert the matrix !!! %d error%c", error, (error-1)?'s':0);
+ }
/* 3c output the atombuf; */
matrix_bang(x);
diff --git a/src/mtx_matrix.c b/src/mtx_matrix.c
index f92a877..58556e8 100644
--- a/src/mtx_matrix.c
+++ b/src/mtx_matrix.c
@@ -442,7 +442,7 @@ static void matrix_read(t_matrix *x, t_symbol *filename)
int n;
if (binbuf_read_via_path(bbuf, filename->s_name, canvas_getdir(x->x_canvas)->s_name, 0))
- error("matrix: failed to read %s", filename->s_name);
+ pd_error(x,"matrix: failed to read %s", filename->s_name);
ap=binbuf_getvec(bbuf);
n =binbuf_getnatom(bbuf)-1;
@@ -465,7 +465,7 @@ static void matrix_write(t_matrix *x, t_symbol *filename)
/* open file */
if (!(f = fopen(filnam, "w"))) {
- error("matrix : failed to open %s", filnam);
+ pd_error(x,"matrix : failed to open %s", filnam);
} else {
char *text=(char *)getbytes(sizeof(char)*MAXPDSTRING);
int textlen;
@@ -478,7 +478,7 @@ static void matrix_write(t_matrix *x, t_symbol *filename)
sprintf(text, "#matrix %d %d\n", rows, cols);
textlen = strlen(text);
if (fwrite(text, textlen*sizeof(char), 1, f) < 1) {
- error("matrix : failed to write %s", filnam); goto end;
+ pd_error(x,"matrix : failed to write %s", filnam); goto end;
}
while(rows--) {
@@ -488,11 +488,11 @@ static void matrix_write(t_matrix *x, t_symbol *filename)
sprintf(text, "%.15f ", val);
textlen=strlen(text);
if (fwrite(text, textlen*sizeof(char), 1, f) < 1) {
- error("matrix : failed to write %s", filnam); goto end;
+ pd_error(x,"matrix : failed to write %s", filnam); goto end;
}
}
if (fwrite("\n", sizeof(char), 1, f) < 1) {
- error("matrix : failed to write %s", filnam); goto end;
+ pd_error(x, "matrix : failed to write %s", filnam); goto end;
}
}
freebytes(text, sizeof(char)*MAXPDSTRING);
diff --git a/src/mtx_mul~.c b/src/mtx_mul~.c
index f0f9c44..b45e1dd 100644
--- a/src/mtx_mul~.c
+++ b/src/mtx_mul~.c
@@ -826,11 +826,11 @@ static void *matrix_multilde_new(t_symbol *s, int argc, t_atom *argv)
x->x_compat=0;
if(s==gensym("matrix~")){
- error("[matrix~] is deprecated! use [mtx_*~] instead!!");
+ pd_error(x,"[matrix~] is deprecated! use [mtx_*~] instead!!");
x->x_compat=2;
}
else if (s==gensym("matrix_mul_line~")){
- error("[matrix_mul_line~] is deprecated! use [mtx_*~] instead!!");
+ pd_error(x,"[matrix_mul_line~] is deprecated! use [mtx_*~] instead!!");
x->x_compat=1;
}
diff --git a/src/mtx_resize.c b/src/mtx_resize.c
index 65c76fe..3678b96 100644
--- a/src/mtx_resize.c
+++ b/src/mtx_resize.c
@@ -20,7 +20,7 @@ static void mtx_resize_list2(t_matrix *x, t_symbol *s, int argc, t_atom *argv)
{
int r, c;
if (argc<1)return;
- if (argc>2)error("mtx_resize : only rows & cols are needed, skipping the rest");
+ if (argc>2)pd_error(x, "mtx_resize : only rows & cols are needed, skipping the rest");
if (argc==1)r=c=atom_getfloat(argv++);
else{
r=atom_getfloat(argv++);