From 21e2f111c461725446457f0d768a95b71c17c847 Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Thu, 14 Aug 2003 02:32:51 +0000 Subject: "" svn path=/trunk/; revision=844 --- externals/grill/flext/source/flatom_pr.cpp | 36 +++++++++++++++++++----------- 1 file changed, 23 insertions(+), 13 deletions(-) (limited to 'externals/grill/flext/source/flatom_pr.cpp') 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 -- cgit v1.2.1