Revision: 4452
          http://pd-gem.svn.sourceforge.net/pd-gem/?rev=4452&view=rev
Author:   zmoelnig
Date:     2011-08-12 13:47:20 +0000 (Fri, 12 Aug 2011)

Log Message:
-----------
implement atomlist->Symbol

Modified Paths:
--------------
    trunk/Gem/src/RTE/Symbol.cpp

Modified: trunk/Gem/src/RTE/Symbol.cpp
===================================================================
--- trunk/Gem/src/RTE/Symbol.cpp        2011-08-12 13:10:15 UTC (rev 4451)
+++ trunk/Gem/src/RTE/Symbol.cpp        2011-08-12 13:47:20 UTC (rev 4452)
@@ -20,6 +20,11 @@
 #include "RTE/Symbol.h"
 #include "Gem/RTE.h"
 
+// for snprintf
+#include <stdio.h>
+#ifdef _WIN32
+# define snprintf _snprintf
+#endif
 
 class gem::RTE::Symbol::PIMPL {
 public:
@@ -75,12 +80,28 @@
   m_pimpl->sym=name;
 }
 gem::RTE::Symbol&gem::RTE::Symbol::setSymbol(const unsigned int argc, const 
t_atom*argv) {
-  if(argc)
-    m_pimpl->sym=atom_getsymbol((t_atom*)argv);
-  else
-    m_pimpl->sym=0;
-    
-  //  m_pimpl->sym=gensym(name.c_str());
+  char buf[MAXPDSTRING];
+  std::string name;
+  bool firsttime=true;
+
+  unsigned int i;
+  for(i=0; i<argc; i++) {
+    t_atom*arg=(t_atom*)(argv+i);
+    std::string atomname;
+    if(A_FLOAT==argv[i].a_type) {
+      snprintf(buf, MAXPDSTRING, "%g", atom_getfloat(arg));
+      buf[MAXPDSTRING-1]=0;
+      atomname=buf;
+    } else {
+      atomname=std::string(atom_getsymbol(arg)->s_name);
+    }
+    if(!firsttime)
+      name+=" ";
+    firsttime=false;
+    name+=atomname; 
+  }
+
+  m_pimpl->sym=gensym(name.c_str());
 }
 
 t_symbol*gem::RTE::Symbol::getRTESymbol(void) const {
@@ -89,6 +110,5 @@
 std::string gem::RTE::Symbol::getString(void) const {
   if(m_pimpl->sym)
     return std::string(m_pimpl->sym->s_name);
-  return std::string();
-      
+  return std::string();      
 }


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system, 
user administration capabilities and model configuration. Take 
the hassle out of deploying and managing Subversion and the 
tools developers use with it. 
http://p.sf.net/sfu/wandisco-dev2dev
_______________________________________________
pd-gem-CVS mailing list
pd-gem-CVS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pd-gem-cvs

Reply via email to