Revision: 2718
http://pd-gem.svn.sourceforge.net/pd-gem/?rev=2718&view=rev
Author: zmoelnig
Date: 2009-03-09 14:35:35 +0000 (Mon, 09 Mar 2009)
Log Message:
-----------
refuse to create with invalid arguments rather than writing unread errors to the console
Modified Paths:
--------------
trunk/Gem/src/Geos/disk.cpp
trunk/Gem/src/Geos/torus.cpp
trunk/Gem/src/Manips/accumrotate.cpp
trunk/Gem/src/Manips/ambient.cpp
trunk/Gem/src/Manips/ambientRGB.cpp
trunk/Gem/src/Manips/color.cpp
trunk/Gem/src/Manips/colorRGB.cpp
trunk/Gem/src/Manips/diffuse.cpp
trunk/Gem/src/Manips/diffuseRGB.cpp
trunk/Gem/src/Manips/emission.cpp
trunk/Gem/src/Manips/emissionRGB.cpp
trunk/Gem/src/Manips/rotate.cpp
trunk/Gem/src/Manips/rotateXYZ.cpp
trunk/Gem/src/Manips/scale.cpp
trunk/Gem/src/Manips/scaleXYZ.cpp
trunk/Gem/src/Manips/shininess.cpp
trunk/Gem/src/Manips/specular.cpp
trunk/Gem/src/Manips/specularRGB.cpp
trunk/Gem/src/Manips/translate.cpp
trunk/Gem/src/Manips/translateXYZ.cpp
trunk/Gem/src/Particles/part_targetcolor.cpp
trunk/Gem/src/Pixes/pix_gain.cpp
Modified: trunk/Gem/src/Geos/disk.cpp
===================================================================
--- trunk/Gem/src/Geos/disk.cpp 2009-03-09 14:33:12 UTC (rev 2717)
+++ trunk/Gem/src/Geos/disk.cpp 2009-03-09 14:35:35 UTC (rev 2718)
@@ -54,7 +54,7 @@
case 0:
break;
default:
- error("needs 1, 2 or 3 arguments (%d)", argc);
+ throw(GemException("needs 0, 1, 2 or 3 arguments"));
}
sizeMess(size);
Modified: trunk/Gem/src/Geos/torus.cpp
===================================================================
--- trunk/Gem/src/Geos/torus.cpp 2009-03-09 14:33:12 UTC (rev 2717)
+++ trunk/Gem/src/Geos/torus.cpp 2009-03-09 14:35:35 UTC (rev 2718)
@@ -54,7 +54,7 @@
case 0:
break;
default:
- error("needs 1, 2 or 3 arguments (%d)", argc);
+ throw(GemException("needs 0, 1, 2 or 3 arguments"));
}
sizeMess(size);
Modified: trunk/Gem/src/Manips/accumrotate.cpp
===================================================================
--- trunk/Gem/src/Manips/accumrotate.cpp 2009-03-09 14:33:12 UTC (rev 2717)
+++ trunk/Gem/src/Manips/accumrotate.cpp 2009-03-09 14:35:35 UTC (rev 2718)
@@ -40,7 +40,7 @@
{ }
else
{
- error("needs 0 or 3 arguments");
+ throw(GemException("needs 0 or 3 arguments"));
}
// create the new inlets
Modified: trunk/Gem/src/Manips/ambient.cpp
===================================================================
--- trunk/Gem/src/Manips/ambient.cpp 2009-03-09 14:33:12 UTC (rev 2717)
+++ trunk/Gem/src/Manips/ambient.cpp 2009-03-09 14:35:35 UTC (rev 2718)
@@ -35,8 +35,7 @@
else if (argc == 0) ambientMess(0.2f, 0.2f, 0.2f, 1.f);
else
{
- error("needs 0, 3, or 4 arguments");
- ambientMess(0.2f, 0.2f, 0.2f, 1.f);
+ throw(GemException("needs 0, 3, or 4 arguments"));
}
// create the new inlet
Modified: trunk/Gem/src/Manips/ambientRGB.cpp
===================================================================
--- trunk/Gem/src/Manips/ambientRGB.cpp 2009-03-09 14:33:12 UTC (rev 2717)
+++ trunk/Gem/src/Manips/ambientRGB.cpp 2009-03-09 14:35:35 UTC (rev 2718)
@@ -51,11 +51,7 @@
}
else
{
- error("needs 0 or 3 arguments");
- m_vector[0] = 0.2f;
- m_vector[1] = 0.2f;
- m_vector[2] = 0.2f;
- m_vector[3] = 1.f;
+ throw(GemException("needs 0, 3 or 4 arguments"));
}
// create the new inlets
Modified: trunk/Gem/src/Manips/color.cpp
===================================================================
--- trunk/Gem/src/Manips/color.cpp 2009-03-09 14:33:12 UTC (rev 2717)
+++ trunk/Gem/src/Manips/color.cpp 2009-03-09 14:35:35 UTC (rev 2718)
@@ -35,8 +35,7 @@
else if (argc == 0) colorMess(1.f, 1.f, 1.f, 1.f);
else
{
- error("needs 0, 3, or 4 arguments");
- colorMess(1.f, 1.f, 1.f, 1.f);
+ throw(GemException("needs 0, 3, or 4 arguments"));
}
// create the new inlet
Modified: trunk/Gem/src/Manips/colorRGB.cpp
===================================================================
--- trunk/Gem/src/Manips/colorRGB.cpp 2009-03-09 14:33:12 UTC (rev 2717)
+++ trunk/Gem/src/Manips/colorRGB.cpp 2009-03-09 14:35:35 UTC (rev 2718)
@@ -51,11 +51,7 @@
}
else
{
- error("needs 0 or 3 arguments");
- m_vector[0] = 1.f;
- m_vector[1] = 1.f;
- m_vector[2] = 1.f;
- m_vector[3] = 1.f;
+ throw(GemException("needs 0, 3 or 4 arguments"));
}
// create the new inlets
Modified: trunk/Gem/src/Manips/diffuse.cpp
===================================================================
--- trunk/Gem/src/Manips/diffuse.cpp 2009-03-09 14:33:12 UTC (rev 2717)
+++ trunk/Gem/src/Manips/diffuse.cpp 2009-03-09 14:35:35 UTC (rev 2718)
@@ -35,8 +35,7 @@
else if (argc == 0) diffuseMess(0.8f, 0.8f, 0.8f, 1.f);
else
{
- error("needs 0, 3, or 4 arguments");
- diffuseMess(0.8f, 0.8f, 0.8f, 1.f);
+ throw(GemException("needs 0, 3, or 4 arguments"));
}
// create the new inlet
Modified: trunk/Gem/src/Manips/diffuseRGB.cpp
===================================================================
--- trunk/Gem/src/Manips/diffuseRGB.cpp 2009-03-09 14:33:12 UTC (rev 2717)
+++ trunk/Gem/src/Manips/diffuseRGB.cpp 2009-03-09 14:35:35 UTC (rev 2718)
@@ -50,13 +50,9 @@
m_vector[3] = 1.0f;
}
else
- {
- error("needs 0 or 3 arguments");
- m_vector[0] = 0.8f;
- m_vector[1] = 0.8f;
- m_vector[2] = 0.8f;
- m_vector[3] = 1.f;
- }
+ {
+ throw(GemException("needs 0, 3 or 4 arguments"));
+ }
// create the new inlets
inlet_new(this->x_obj, &this->x_obj->ob_pd, &s_float, gensym("rVal"));
Modified: trunk/Gem/src/Manips/emission.cpp
===================================================================
--- trunk/Gem/src/Manips/emission.cpp 2009-03-09 14:33:12 UTC (rev 2717)
+++ trunk/Gem/src/Manips/emission.cpp 2009-03-09 14:35:35 UTC (rev 2718)
@@ -37,8 +37,7 @@
else if (argc == 0) emissionMess(0.f, 0.f, 0.f, 1.f);
else
{
- error("needs 0, 3, or 4 arguments");
- emissionMess(0.f, 0.f, 0.f, 1.f);
+ throw(GemException("needs 0, 3, or 4 arguments"));
}
// create the new inlet
Modified: trunk/Gem/src/Manips/emissionRGB.cpp
===================================================================
--- trunk/Gem/src/Manips/emissionRGB.cpp 2009-03-09 14:33:12 UTC (rev 2717)
+++ trunk/Gem/src/Manips/emissionRGB.cpp 2009-03-09 14:35:35 UTC (rev 2718)
@@ -53,11 +53,7 @@
}
else
{
- error("needs 0 or 3 arguments");
- m_vector[0] = 0.f;
- m_vector[1] = 0.f;
- m_vector[2] = 0.f;
- m_vector[3] = 1.f;
+ throw(GemException("needs 0, 3 or 4 arguments"));
}
// create the new inlets
Modified: trunk/Gem/src/Manips/rotate.cpp
===================================================================
--- trunk/Gem/src/Manips/rotate.cpp 2009-03-09 14:33:12 UTC (rev 2717)
+++ trunk/Gem/src/Manips/rotate.cpp 2009-03-09 14:35:35 UTC (rev 2718)
@@ -28,25 +28,24 @@
/////////////////////////////////////////////////////////
rotate :: rotate(int argc, t_atom *argv)
{
- m_angle = 0.0;
- if (argc == 4)
+ m_angle = 0.0;
+ if (argc == 4)
{
- m_angle = atom_getfloat(&argv[0]);
- vectorMess(atom_getfloat(&argv[1]), atom_getfloat(&argv[2]), atom_getfloat(&argv[3]));
+ m_angle = atom_getfloat(&argv[0]);
+ vectorMess(atom_getfloat(&argv[1]), atom_getfloat(&argv[2]), atom_getfloat(&argv[3]));
}
- else if (argc == 3) vectorMess(atom_getfloat(&argv[0]), atom_getfloat(&argv[1]),
- atom_getfloat(&argv[2]));
+ else if (argc == 3) vectorMess(atom_getfloat(&argv[0]), atom_getfloat(&argv[1]),
+ atom_getfloat(&argv[2]));
- else if (argc == 0) vectorMess(1, 0, 0);
- else
+ else if (argc == 0) vectorMess(1, 0, 0);
+ else
{
- error("needs 0, 3, or 4 arguments");
- vectorMess(1, 0, 0);
+ throw(GemException("needs 0, 3, or 4 arguments"));
}
- // create the new inlets
- inlet_new(this->x_obj, &this->x_obj->ob_pd, &s_float, gensym("ft1"));
- inlet_new(this->x_obj, &this->x_obj->ob_pd, &s_list, gensym("vector"));
+ // create the new inlets
+ inlet_new(this->x_obj, &this->x_obj->ob_pd, &s_float, gensym("ft1"));
+ inlet_new(this->x_obj, &this->x_obj->ob_pd, &s_list, gensym("vector"));
}
/////////////////////////////////////////////////////////
Modified: trunk/Gem/src/Manips/rotateXYZ.cpp
===================================================================
--- trunk/Gem/src/Manips/rotateXYZ.cpp 2009-03-09 14:33:12 UTC (rev 2717)
+++ trunk/Gem/src/Manips/rotateXYZ.cpp 2009-03-09 14:35:35 UTC (rev 2718)
@@ -42,10 +42,7 @@
}
else
{
- error("needs 0 or 3 arguments");
- m_vector[0] = 0.f;
- m_vector[1] = 0.f;
- m_vector[2] = 0.f;
+ throw(GemException("needs 0 or 3 arguments"));
}
// create the new inlets
Modified: trunk/Gem/src/Manips/scale.cpp
===================================================================
--- trunk/Gem/src/Manips/scale.cpp 2009-03-09 14:33:12 UTC (rev 2717)
+++ trunk/Gem/src/Manips/scale.cpp 2009-03-09 14:35:35 UTC (rev 2718)
@@ -28,32 +28,31 @@
/////////////////////////////////////////////////////////
scale :: scale(int argc, t_atom *argv)
{
- m_distance = 0.0f;
- if (argc == 4)
+ m_distance = 0.0f;
+ if (argc == 4)
{
- m_distance = atom_getfloat(&argv[0]);
- vectorMess(atom_getfloat(&argv[1]), atom_getfloat(&argv[2]), atom_getfloat(&argv[3]));
+ m_distance = atom_getfloat(&argv[0]);
+ vectorMess(atom_getfloat(&argv[1]), atom_getfloat(&argv[2]), atom_getfloat(&argv[3]));
}
- else if (argc == 3)
- {
- m_distance = 1.f;
- vectorMess(atom_getfloat(&argv[0]), atom_getfloat(&argv[1]), atom_getfloat(&argv[2]));
- }
- else if (argc == 1)
- {
- m_distance = atom_getfloat(&argv[0]);
- vectorMess(1.f, 1.f, 1.f);
+ else if (argc == 3)
+ {
+ m_distance = 1.f;
+ vectorMess(atom_getfloat(&argv[0]), atom_getfloat(&argv[1]), atom_getfloat(&argv[2]));
}
- else if (argc == 0) vectorMess(1.f, 1.f, 1.f);
- else
+ else if (argc == 1)
{
- error("needs 0, 1, 3, or 4 arguments");
- vectorMess(1.f, 1.f, 1.f);
+ m_distance = atom_getfloat(&argv[0]);
+ vectorMess(1.f, 1.f, 1.f);
}
-
- // create the new inlets
- inlet_new(this->x_obj, &this->x_obj->ob_pd, &s_float, gensym("ft1"));
- inlet_new(this->x_obj, &this->x_obj->ob_pd, &s_list, gensym("vector"));
+ else if (argc == 0) vectorMess(1.f, 1.f, 1.f);
+ else
+ {
+ throw(GemException("needs 0, 1, 3, or 4 arguments"));
+ }
+
+ // create the new inlets
+ inlet_new(this->x_obj, &this->x_obj->ob_pd, &s_float, gensym("ft1"));
+ inlet_new(this->x_obj, &this->x_obj->ob_pd, &s_list, gensym("vector"));
}
/////////////////////////////////////////////////////////
Modified: trunk/Gem/src/Manips/scaleXYZ.cpp
===================================================================
--- trunk/Gem/src/Manips/scaleXYZ.cpp 2009-03-09 14:33:12 UTC (rev 2717)
+++ trunk/Gem/src/Manips/scaleXYZ.cpp 2009-03-09 14:35:35 UTC (rev 2718)
@@ -48,10 +48,7 @@
}
else
{
- error("needs 0, 1, or 3 arguments");
- m_vector[0] = 1.f;
- m_vector[1] = 1.f;
- m_vector[2] = 1.f;
+ throw(GemException("needs 0, 1, or 3 arguments"));
}
// create the new inlets
Modified: trunk/Gem/src/Manips/shininess.cpp
===================================================================
--- trunk/Gem/src/Manips/shininess.cpp 2009-03-09 14:33:12 UTC (rev 2717)
+++ trunk/Gem/src/Manips/shininess.cpp 2009-03-09 14:35:35 UTC (rev 2718)
@@ -34,8 +34,7 @@
else if (argc == 0) shininessMess(0.f);
else
{
- error("needs 0 or 1 arguments");
- shininessMess(0.f);
+ throw(GemException("needs 0 or 1 arguments"));
}
// create the new inlet
Modified: trunk/Gem/src/Manips/specular.cpp
===================================================================
--- trunk/Gem/src/Manips/specular.cpp 2009-03-09 14:33:12 UTC (rev 2717)
+++ trunk/Gem/src/Manips/specular.cpp 2009-03-09 14:35:35 UTC (rev 2718)
@@ -37,8 +37,7 @@
else if (argc == 0) specularMess(0.f, 0.f, 0.f, 1.f);
else
{
- error("needs 0, 3, or 4 arguments");
- specularMess(0.f, 0.f, 0.f, 1.f);
+ throw(GemException("needs 0, 3, or 4 arguments"));
}
// create the new inlet
Modified: trunk/Gem/src/Manips/specularRGB.cpp
===================================================================
--- trunk/Gem/src/Manips/specularRGB.cpp 2009-03-09 14:33:12 UTC (rev 2717)
+++ trunk/Gem/src/Manips/specularRGB.cpp 2009-03-09 14:35:35 UTC (rev 2718)
@@ -53,11 +53,7 @@
}
else
{
- error("needs 0 or 3 arguments");
- m_vector[0] = 0.f;
- m_vector[1] = 0.f;
- m_vector[2] = 0.f;
- m_vector[3] = 1.f;
+ throw(GemException("needs 0, 3 or 4 arguments"));
}
// create the new inlets
Modified: trunk/Gem/src/Manips/translate.cpp
===================================================================
--- trunk/Gem/src/Manips/translate.cpp 2009-03-09 14:33:12 UTC (rev 2717)
+++ trunk/Gem/src/Manips/translate.cpp 2009-03-09 14:35:35 UTC (rev 2718)
@@ -40,8 +40,7 @@
else if (argc == 0) vectorMess(1, 0, 0);
else
{
- error("needs 0, 3, or 4 arguments");
- vectorMess(1, 0, 0);
+ throw(GemException("needs 0, 3, or 4 arguments"));
}
// create the new inlets
Modified: trunk/Gem/src/Manips/translateXYZ.cpp
===================================================================
--- trunk/Gem/src/Manips/translateXYZ.cpp 2009-03-09 14:33:12 UTC (rev 2717)
+++ trunk/Gem/src/Manips/translateXYZ.cpp 2009-03-09 14:35:35 UTC (rev 2718)
@@ -40,8 +40,7 @@
}
else
{
- error("needs 0 or 3 arguments");
- m_vector[0] = m_vector[1] = m_vector[2] = 0;
+ throw(GemException("needs 0 or 3 arguments"));
}
// create the new inlets
Modified: trunk/Gem/src/Particles/part_targetcolor.cpp
===================================================================
--- trunk/Gem/src/Particles/part_targetcolor.cpp 2009-03-09 14:33:12 UTC (rev 2717)
+++ trunk/Gem/src/Particles/part_targetcolor.cpp 2009-03-09 14:35:35 UTC (rev 2718)
@@ -36,20 +36,19 @@
atom_getfloat(&argv[2]), atom_getfloat(&argv[3]));
scaleMess(atom_getfloat(&argv[4]));
}
- else if (argc == 4) colorMess(atom_getfloat(&argv[0]), atom_getfloat(&argv[1]),
- atom_getfloat(&argv[2]), atom_getfloat(&argv[3]));
- else if (argc == 3) colorMess(atom_getfloat(&argv[0]), atom_getfloat(&argv[1]),
- atom_getfloat(&argv[2]), 1.f);
- else if (argc == 0) colorMess(1.f, 1.f, 1.f, 1.f);
- else
+ else if (argc == 4) colorMess(atom_getfloat(&argv[0]), atom_getfloat(&argv[1]),
+ atom_getfloat(&argv[2]), atom_getfloat(&argv[3]));
+ else if (argc == 3) colorMess(atom_getfloat(&argv[0]), atom_getfloat(&argv[1]),
+ atom_getfloat(&argv[2]), 1.f);
+ else if (argc == 0) colorMess(1.f, 1.f, 1.f, 1.f);
+ else
{
- error("needs 0, 3, 4, or 5 arguments");
- colorMess(1.f, 1.f, 1.f, 1.f);
+ throw(GemException("needs 0, 3, 4, or 5 arguments"));
}
- // create the new inlet
- inlet_new(this->x_obj, &this->x_obj->ob_pd, &s_list, gensym("color"));
- inlet_new(this->x_obj, &this->x_obj->ob_pd, &s_float, gensym("ft1"));
+ // create the new inlet
+ inlet_new(this->x_obj, &this->x_obj->ob_pd, &s_list, gensym("color"));
+ inlet_new(this->x_obj, &this->x_obj->ob_pd, &s_float, gensym("ft1"));
}
/////////////////////////////////////////////////////////
Modified: trunk/Gem/src/Pixes/pix_gain.cpp
===================================================================
--- trunk/Gem/src/Pixes/pix_gain.cpp 2009-03-09 14:33:12 UTC (rev 2717)
+++ trunk/Gem/src/Pixes/pix_gain.cpp 2009-03-09 14:35:35 UTC (rev 2718)
@@ -44,7 +44,7 @@
case 0:
break;
default:
- error("needs 0, 3, or 4 arguments");
+ throw(GemException("needs 0, 1, 3, or 4 arguments"));
break;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|