Coder Social home page Coder Social logo

pd_nusmuk_utils's Introduction

This are a collection of usefull abstraction and that can be usefull.

This lib is made by Cyrille Henry (exept pbank for zack settel), you can contact him on his webpage : 
http://www.chnry.net/ch/?001-Cyrille-Henry

This lib is realese under the GNU Public License.

To build it, just type make.

pd_nusmuk_utils's People

Contributors

ch-nry avatar

Stargazers

 avatar  avatar

Watchers

 avatar

pd_nusmuk_utils's Issues

replace error() with pd_error()

--- pd-nusmuk.orig/utils/mtx_preset.c
+++ pd-nusmuk/utils/mtx_preset.c
@@ -117,7 +117,7 @@
         }
     }
     else {
-        error("bad matrix");
+        pd_error(x, "bad matrix");
         return;
     }
 }
@@ -130,7 +130,7 @@
     if ((argc > 0) && (argv[0].a_type == A_FLOAT)) 
         row = atom_getfloatarg(0,argc,argv);
     else {
-        error("bad row");
+        pd_error(x, "bad row");
         return;
     }
     row = min(x->sizeY-1, row);
@@ -148,7 +148,7 @@
     if ((argc > 0) && (argv[0].a_type == A_FLOAT)) 
         col = atom_getfloatarg(0,argc,argv);
     else {
-        error("bad col");
+        pd_error(x, "bad col");
         return;
     }
     col = min(x->sizeX-1, col);
--- pd-nusmuk.orig/utils/pbank.c
+++ pd-nusmuk/utils/pbank.c
@@ -156,12 +156,12 @@
     if (ac < 3)
     {
     	post("ac=%d",ac);
-	error("pbank_set: takes at least 3 arguments: column row item(s)");
+	pd_error(x, "pbank_set: takes at least 3 arguments: column row item(s)");
 	return;
     }
     if ((argv)->a_type != A_FLOAT || (argv+1)->a_type != A_FLOAT)    
     {
-	error("pbank_set: first arguments must of type float (columnNo. or rowNo.)");
+	pd_error(x, "pbank_set: first arguments must of type float (columnNo. or rowNo.)");
 	return;
     }
 
@@ -179,7 +179,7 @@
     {
 	if ((argv)->a_type != A_FLOAT && (argv)->a_type != A_SYMBOL && (argv)->a_type != A_FLOAT)  
 	{
-	    error("pbank_set:  argument no %d must be afloat or symbol",ac+1);
+	    pd_error(x, "pbank_set:  argument no %d must be afloat or symbol",ac+1);
 	    return;
 	}    
 	*(shit+column++) = *argv++;
@@ -197,12 +197,12 @@
     if (ac < 2)
     {
     	post("ac=%d",ac);
-	error("pbank_put: takes at least 2 arguments: column item(s)");
+	pd_error(x, "pbank_put: takes at least 2 arguments: column item(s)");
 	return;
     }
     if ((argv)->a_type != A_FLOAT)    
     {
-	error("pbank_put: first argument must a number (columnNo.)");
+	pd_error(x, "pbank_put: first argument must a number (columnNo.)");
 	return;
     }
     if ((column = (int)(argv)->a_w.w_float) < 0) column = 0;
@@ -216,7 +216,7 @@
     {
 	if ((argv)->a_type != A_FLOAT && (argv)->a_type != A_SYMBOL && (argv)->a_type != A_FLOAT)  
 	{
-	    error("pbank_put:  argument no %d must be a float or symbol",ac);
+	    pd_error(x, "pbank_put:  argument no %d must be a float or symbol",ac);
 	    return;
 	}    
 	*(shit+column++) = *argv++;
@@ -266,7 +266,7 @@
 		else if (ebuff->a_type == A_SYMBOL) type = z_symbol;
 		else 
 		{
-		    error("pbank_list: 3rd element must be a float or sym.");
+		    pd_error(x, "pbank_list: 3rd element must be a float or sym.");
 		    goto exit;
 		}
 		typedmess(x->p_receives[z]->s_thing, type,ac, ebuff);
@@ -342,7 +342,7 @@
 	      if (interpfac <.5) SETSYMBOL(ebuff, av->a_w.w_symbol);
 	      else SETSYMBOL(ebuff, avplus1->a_w.w_symbol);			
 	  }	
-	  else error("pbank: bug found in recallf method");
+	  else pd_error(x, "pbank: bug found in recallf method");
 	}
 
 #ifdef why_is_this_here_sheefa
@@ -362,7 +362,7 @@
 			if (ebuff->a_type == A_FLOAT && av->a_type == A_FLOAT)
 				SETFLOAT(ebuff, ebuff->a_w.w_float + av->a_w.w_float * (indexf - u +1)); 			else if (ebuff->a_type == A_SYMBOL)
 				SETSYMBOL(ebuff, av->a_w.w_symbol);
-			else 	error("pbank: bug found in recallf method");	
+			else 	pd_error(x, "pbank: bug found in recallf method");	
 		}
 	}
 
@@ -387,7 +387,7 @@
 				if (ebuff->a_type == A_SYMBOL) type = z_symbol;
 				else 
 					{
-					error("pbank_list: 3rd element must be a float or sym.");
+					pd_error(x, "pbank_list: 3rd element must be a float or sym.");
 					goto exit;
 					}
 				typedmess(x->p_receives[z]->s_thing, type,ac, ebuff);
@@ -472,7 +472,7 @@
 				if (ebuff->a_type == A_SYMBOL) type = z_symbol;
 				else 
 				{
-					error("pbank_list: 3rd element must be a float or sym.");
+					pd_error(x, "pbank_list: 3rd element must be a float or sym.");
 					goto exit;
 				}
 				typedmess(x->p_receives[z]->s_thing, type,ac, ebuff);
@@ -533,7 +533,7 @@
 				   else if (ebuff->a_type == A_SYMBOL) type = z_symbol;
 				   else 
 				   {
-					   error("pbank_list: 3rd element must be a float or sym.");
+					   pd_error(x, "pbank_list: 3rd element must be a float or sym.");
 					   goto exit;
 				   }
 				   typedmess(x->p_receives[z]->s_thing, type,ac, ebuff);
@@ -582,7 +582,7 @@
 					else if (ebuff->a_type == A_SYMBOL) type = z_symbol;
 					else 
 					{
-						error("pbank_list: 3rd element must be a float or sym.");
+						pd_error(x, "pbank_list: 3rd element must be a float or sym.");
 						goto exit;
 					}
 					typedmess(x->p_receives[z]->s_thing, type,ac, ebuff);
@@ -649,14 +649,14 @@
 
     if ((argc != 2) && (argc != 3))
     {
-	error("pbank_list: less than 2, or more than 3 elements in list");
+	pd_error(x, "pbank_list: less than 2, or more than 3 elements in list");
 	goto exit;
     }
     
     
     if (((argv)->a_type != A_FLOAT) || ((argv+1)->a_type != A_FLOAT))
     {
-	error("pbank_list: first two elements must be numbers");
+	pd_error(x, "pbank_list: first two elements must be numbers");
 	goto exit;
     }
     if ((column = (int)(argv)->a_w.w_float) < 0) column = 0;
@@ -690,7 +690,7 @@
 		else if (av->a_type == A_SYMBOL) type = z_symbol;
 		else 
 		{
-		    error("pbank_list: 3rd element must be a float or sym.");
+		    pd_error(x, "pbank_list: 3rd element must be a float or sym.");
 		    goto exit;
 		}
 		typedmess(x->p_receives[column]->s_thing, type,ac, av);
@@ -731,7 +731,7 @@
 		    SETSYMBOL(av,(argv+2)->a_w.w_symbol);
 		    break;
 	    default: 	
-		error("pbank_list: 3rd element must be a float or sym.");
+		pd_error(x, "pbank_list: 3rd element must be a float or sym.");
 		goto exit;
 	}
     *x->p_dirty = (t_atom *)1;	/* set dirty flag */
@@ -756,7 +756,7 @@
                                                 /* get pbank symbol */
     if (ap->a_type != A_SYMBOL || ap->a_w.w_symbol != gensym("pbank"))
     {
-	error("pbank_fromtext: bad file format: item one must be the symbol 'pbank");
+	pd_error(x, "pbank_fromtext: bad file format: item one must be the symbol 'pbank");
 	goto error;
     }
 
@@ -767,7 +767,7 @@
     	// binbuf_getatom(b,&p1,&p2,&at);		/* get columns and rows */
 	if (ap->a_type != A_FLOAT)
 	{
-	    error("pbank_fromtext: bad file format: item two and three must be COLUMNcount and ROWcount");
+	    pd_error(x, "pbank_fromtext: bad file format: item two and three must be COLUMNcount and ROWcount");
 	    goto error;
 	}
 	if (z==0) columns = (int)ap->a_w.w_float;
@@ -776,12 +776,12 @@
    
     if (columns < 1 || rows < 1)
     {
-	error("pbank_fromtext: bad value(s) for item two and/or three (COLUMNcount and/or ROWcount)");
+	pd_error(x, "pbank_fromtext: bad value(s) for item two and/or three (COLUMNcount and/or ROWcount)");
 	goto error;
     }
     if (columns != x->p_columns)
     {
-	error("pbank_fromtext: bad file format: wrong no. of columns (%d) in file", columns);
+	pd_error(x, "pbank_fromtext: bad file format: wrong no. of columns (%d) in file", columns);
 	goto error;
     }
     
@@ -789,7 +789,7 @@
     ap++, count++;
     if (ap->a_type != A_COMMA)
     {
-	error("pbank_fromtext: bad file format: comma expected after third item");
+	pd_error(x, "pbank_fromtext: bad file format: comma expected after third item");
 	goto error;
     }
     
@@ -806,7 +806,7 @@
         if (rowpos > x->p_rows)	// safety check- remove later
         {
             bug("pbank_fromtext: rowpos=%d x->p_rows=%d  items=%d  argc=%d",rowpos,x->p_rows,count,argc);
-            error("pbank_fromtext: rowpos greater than x->p_rows:  aborting");
+            pd_error(x, "pbank_fromtext: rowpos greater than x->p_rows:  aborting");
             goto error;
         }
    
@@ -820,7 +820,7 @@
 	    if (count == argc)  goto done;
             else 
             {
-                error("pbank_fromtext: unexpected A_NULL type read at position %d: aborting", count);
+                pd_error(x, "pbank_fromtext: unexpected A_NULL type read at position %d: aborting", count);
                 goto error;
             }
 	}
@@ -990,7 +990,7 @@
     binbuf_free(b);
 
     if (errorf) 
-        error("pbank_saveto: couldn't write %s", fn);
+        pd_error(x, "pbank_saveto: couldn't write %s", fn);
     else 
     {
         *x->p_dirty = NIL;
@@ -1027,7 +1027,7 @@
 	}
 	if (!piss) 
 	{
-	    error("pbank_dispose: bug found- can't find symbol");
+	    pd_error(x, "pbank_dispose: bug found- can't find symbol");
 	    goto skip;
 	}
        /*  post("found %s", piss->s_sym->s_name); */
@@ -1053,7 +1053,7 @@
 	    {
 		if (!prePiss) 
 		{
-		    error("bug found in pbank_dispose (prePiss)");
+		    pd_error(x, "bug found in pbank_dispose (prePiss)");
 		    goto skip;
 		}
 		/* post("������ last element in list"); */
@@ -1071,7 +1071,7 @@
 	{
 	    if (!prePiss) 
 	    {
-		error("bug found in pbank_dispose (prePiss)");
+		pd_error(x, "bug found in pbank_dispose (prePiss)");
 		goto skip;
 	    }
 	  /*  post("������ embedded element in list"); */
@@ -1147,7 +1147,7 @@
 
     if (!InRange(argc,2,4))
     {
-	error("pbank_new: bad arg count - takes: columns rows fname <opt symbol> sendname");
+	pd_error(x, "pbank_new: bad arg count - takes: columns rows fname <opt symbol> sendname");
 	goto err;
     }
     
@@ -1156,14 +1156,14 @@
     
     if (((argv)->a_type != A_FLOAT) || ((argv+1)->a_type != A_FLOAT))
     {
-	error("pbank_new: first two elements must be numbers");
+	pd_error(x, "pbank_new: first two elements must be numbers");
 	goto err;
     }
 
 
 //    if ((argv)->a_w.w_float < 1 || (argv+1)->a_w.w_float < 1) 
 //    {
-//	error("pbank_new: first or second argument less than 1, can't continue");
+//	pd_error(x, "pbank_new: first or second argument less than 1, can't continue");
 //	goto err;
 //    }	 
 
@@ -1188,7 +1188,7 @@
     {
 	if ((argv+2)->a_type != A_SYMBOL)
 	{
-	    error("pbank_new: bad third arg: needs to be a symbol (or empty string %s)",gensym("")->s_name);
+	    pd_error(x, "pbank_new: bad third arg: needs to be a symbol (or empty string %s)",gensym("")->s_name);
 	    goto err;
 	}
 	shit = (argv+2)->a_w.w_symbol->s_name;
@@ -1208,7 +1208,7 @@
             }
             else 
             {
-                error("pbank_new: optional fourth arg. needs to be a symbol");
+                pd_error(x, "pbank_new: optional fourth arg. needs to be a symbol");
                 goto err;
             }
         }
@@ -1237,7 +1237,7 @@
                     strcmp(class_getname(pd_class(x->p_receives[z]->s_thing)), "receive") &&
                     strcmp(class_getname(pd_class(x->p_receives[z]->s_thing)), "bindlist"))
 		{
- 		    error("pbank_new: symbol %s already being used, can't use it",shit);
+ 		    pd_error(x, "pbank_new: symbol %s already being used, can't use it",shit);
 		    post("z=%d  found a %s",z,class_getname(pd_class(x->p_receives[z]->s_thing)));
 		    goto err;
 		}
@@ -1299,7 +1299,7 @@
 		    {
 		    	if (piss->s_columns != columns || piss->s_rows != rows)
 			{
-			    error("pbank_getmem: pbank %s's dimensions must be (%d x %d)",name->s_name,
+			    pd_error(0, "pbank_getmem: pbank %s's dimensions must be (%d x %d)",name->s_name,
 			    			 piss->s_columns,piss->s_rows);
 			    return(NIL);
 			}
@@ -1309,12 +1309,12 @@
 		    }
 		    piss = piss->s_next;
 		}
-		error("pbank_getmem: bug: name %s not found",name->s_name);
+		pd_error(0, "pbank_getmem: bug: name %s not found",name->s_name);
 		return(NIL);
 	    }
 	    else /* bad symbol - already taken - can't do anything */
 	    {
-		error("pbank_getmem: symbol %s already being used by another object",name->s_name);
+		pd_error(0, "pbank_getmem: symbol %s already being used by another object",name->s_name);
 		return(NIL);
 	    }
 	}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.