aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/flext/source/flatom_pr.cpp
diff options
context:
space:
mode:
authorThomas Grill <xovo@users.sourceforge.net>2003-08-14 02:32:51 +0000
committerThomas Grill <xovo@users.sourceforge.net>2003-08-14 02:32:51 +0000
commit21e2f111c461725446457f0d768a95b71c17c847 (patch)
tree7d694777621bab83dbe3ce09f5d57ab91c0e8f85 /externals/grill/flext/source/flatom_pr.cpp
parent83ff55addd23a3536ed179b58498a95321ce0482 (diff)
""
svn path=/trunk/; revision=844
Diffstat (limited to 'externals/grill/flext/source/flatom_pr.cpp')
-rw-r--r--externals/grill/flext/source/flatom_pr.cpp36
1 files changed, 23 insertions, 13 deletions
diff --git a/externals/grill/flext/source/flatom_pr.cpp b/externals/grill/flext/source/flatom_pr.cpp
index e700df8a..e90892e8 100644
--- a/externals/grill/flext/source/flatom_pr.cpp
+++ b/externals/grill/flext/source/flatom_pr.cpp
@@ -21,39 +21,49 @@ WARRANTIES, see the file, "license.txt," in this distribution.
// \TODO take bufsz into account!
bool flext::PrintAtom(const t_atom &a,char *buf,int bufsz)
{
+ bool ok = true;
if(IsFloat(a)) {
- sprintf(buf,"%g",GetFloat(a));
+ STD::sprintf(buf,"%g",GetFloat(a));
}
else if(IsInt(a)) {
- sprintf(buf,"%i",GetInt(a));
+ STD::sprintf(buf,"%i",GetInt(a));
}
else if(IsSymbol(a)) {
- strcpy(buf,GetString(a));
+ STD::strcpy(buf,GetString(a));
}
else if(IsPointer(a)) {
- sprintf(buf,"%p",GetPointer(a));
+ STD::sprintf(buf,"%p",GetPointer(a));
+ }
+ else if(a.a_type == A_DOLLAR) {
+ STD::sprintf(buf,"$%d",a.a_w.w_index);
}
- else
+ else if(a.a_type == A_DOLLSYM) {
+ STD::sprintf(buf,"$%s",GetString(a));
+ }
+ else {
ERRINTERNAL();
- return true;
+ ok = false;
+ }
+ return ok;
}
-bool flext::AtomList::Print(char *buffer,int buflen) const
+bool flext::PrintList(int argc,const t_atom *argv,char *buf,int bufsz)
{
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;
+ for(int i = 0; ok && i < argc && bufsz > 0; ++i) {
+ if(i) { *(buf++) = ' '; --bufsz; } // prepend space
+
+ if(PrintAtom(argv[i],buf,bufsz)) {
+ int len = strlen(buf);
+ buf += len,bufsz -= len;
}
else
ok = false;
}
+ *buf = 0;
return ok;
}
-
bool flext::ScanAtom(t_atom &a,const char *buf)
{
// skip whitespace