aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/flext/source/flatom_pr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'externals/grill/flext/source/flatom_pr.cpp')
-rw-r--r--externals/grill/flext/source/flatom_pr.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/externals/grill/flext/source/flatom_pr.cpp b/externals/grill/flext/source/flatom_pr.cpp
index 639bca63..e700df8a 100644
--- a/externals/grill/flext/source/flatom_pr.cpp
+++ b/externals/grill/flext/source/flatom_pr.cpp
@@ -19,7 +19,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#include <stdio.h>
// \TODO take bufsz into account!
-void flext::PrintAtom(const t_atom &a,char *buf,int bufsz)
+bool flext::PrintAtom(const t_atom &a,char *buf,int bufsz)
{
if(IsFloat(a)) {
sprintf(buf,"%g",GetFloat(a));
@@ -35,8 +35,25 @@ void flext::PrintAtom(const t_atom &a,char *buf,int bufsz)
}
else
ERRINTERNAL();
+ return true;
}
+bool flext::AtomList::Print(char *buffer,int buflen) const
+{
+ bool ok = true;
+ for(int i = 0; ok && i < Count(); ++i) {
+ if(i) { *(buffer++) = ' '; --buflen; } // prepend space
+ if(PrintAtom((*this)[i],buffer,buflen)) {
+ int len = strlen(buffer);
+ buffer += len,buflen -= len;
+ }
+ else
+ ok = false;
+ }
+ return ok;
+}
+
+
bool flext::ScanAtom(t_atom &a,const char *buf)
{
// skip whitespace