[PD-cvs] externals/grill/flext/source flattr_ed.cpp,1.22,1.23

Thomas Grill xovo at users.sourceforge.net
Thu Nov 4 04:30:40 CET 2004


Update of /cvsroot/pure-data/externals/grill/flext/source
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21011/source

Modified Files:
	flattr_ed.cpp 
Log Message:
more character escaping for attribute editor


Index: flattr_ed.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flattr_ed.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** flattr_ed.cpp	9 Sep 2004 04:00:46 -0000	1.22
--- flattr_ed.cpp	4 Nov 2004 03:30:38 -0000	1.23
***************
*** 85,88 ****
--- 85,89 ----
                  "set a [regsub {,} $a \\\\,]\n"  // replace , with \,
                  "set a [regsub {;} $a \\\\\\;]\n"  // replace ; with \;
+ //                "set a [regsub {%} $a %%]\n"  // replace % with \%
                  "lappend tmp $a\n"
              "}\n"
***************
*** 424,427 ****
--- 425,441 ----
  }
  
+ static size_t escapeit(char *dst,size_t maxlen,const char *src)
+ {
+     int ret = 0;
+     for(char *d = dst; *src && (d-dst) < (int)maxlen; ++src) {
+         if(*src == '%')
+             *(d++) = '%',*(d++) = '%';
+         else
+             *(d++) = *src;
+     }
+     *d = 0;
+     return d-dst;
+ }
+ 
  void flext_base::cb_GfxProperties(t_gobj *c, t_glist *)
  {
***************
*** 492,496 ****
              th->GetAttrib(sym,gattr,lv);
  
!             PrintList(lv.Count(),lv.Atoms(),b,sizeof(buf)+buf-b); b += strlen(b);
          }
          else {
--- 506,515 ----
              th->GetAttrib(sym,gattr,lv);
  
!             for(int i = 0; i < lv.Count(); ++i) {
!                 char tmp[100];
!                 PrintAtom(lv[i],tmp,sizeof tmp);
!                 b += escapeit(b,sizeof(buf)+buf-b,tmp);
!                 if(i < lv.Count()-1) { *(b++) = ' '; *(b++) = 0; }
!             }
          }
          else {
***************
*** 504,508 ****
              const AtomList &lp = initdata?*initdata:lv;
  
!             PrintList(lp.Count(),lp.Atoms(),b,sizeof(buf)+buf-b); b += strlen(b);
          }
          else {
--- 523,532 ----
              const AtomList &lp = initdata?*initdata:lv;
  
!             for(int i = 0; i < lp.Count(); ++i) {
!                 char tmp[100];
!                 PrintAtom(lp[i],tmp,sizeof(tmp)); 
!                 b += escapeit(b,sizeof(buf)+buf-b,tmp);
!                 if(i < lp.Count()-1) { *(b++) = ' '; *(b++) = 0; }
!             }
          }
          else {





More information about the Pd-cvs mailing list