[PD-cvs] pd/src kernel.c,1.1.2.61,1.1.2.62

Mathieu Bouchard matju at users.sourceforge.net
Wed Jul 18 18:16:09 CEST 2007


Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3668

Modified Files:
      Tag: desiredata
	kernel.c 
Log Message:
removed some MAXPDSTRING


Index: kernel.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/kernel.c,v
retrieving revision 1.1.2.61
retrieving revision 1.1.2.62
diff -C2 -d -r1.1.2.61 -r1.1.2.62
*** kernel.c	18 Jul 2007 07:37:56 -0000	1.1.2.61
--- kernel.c	18 Jul 2007 16:16:07 -0000	1.1.2.62
***************
*** 257,261 ****
      case A_DOLLAR:  buf << "$" << a->a_index; break;
      case A_DOLLSYM: buf << a->a_symbol->name; break;
!     default: bug("atom_string");
      }
  }
--- 257,261 ----
      case A_DOLLAR:  buf << "$" << a->a_index; break;
      case A_DOLLSYM: buf << a->a_symbol->name; break;
!     default: bug("%s",__PRETTY_FUNCTION__);
      }
  }
***************
*** 1718,1746 ****
  }
  
  /* convert a binbuf to text; no null termination. */
  void binbuf_gettext(t_binbuf *x, char **bufp, int *lengthp) {
!     char *buf = (char *)malloc(1), *newbuf;
!     int length = 0;
!     char string[MAXPDSTRING];
      t_atom *ap = x->v;
      for (int i=x->n; i--; ap++) {
!         if ((ap->a_type == A_SEMI || ap->a_type == A_COMMA) && length && buf[length-1] == ' ') length--;
!         atom_string(ap, string, MAXPDSTRING);
!         int newlength = length + strlen(string) + 1;
!         if (!(newbuf = (char *)realloc(buf,newlength))) break;
!         buf = newbuf;
!         strcpy(buf + length, string);
!         length = newlength;
!         buf[length-1] = ap->a_type == A_SEMI ? '\n' : ' ';
!     }
!     if (length && buf[length-1] == ' ') {
!         newbuf = (char *)realloc(buf,length+1);
!         if (newbuf) {
!             buf = newbuf;
!             length--;
!         }
      }
!     *bufp = buf;
!     *lengthp = length;
  }
  
--- 1718,1739 ----
  }
  
+ /* YOU WISH */
+ void oprintf(ostream &buf, const char *s, ...) {
+     // lalalalalère...
+ }
+ 
  /* convert a binbuf to text; no null termination. */
  void binbuf_gettext(t_binbuf *x, char **bufp, int *lengthp) {
!     ostringstream buf;
      t_atom *ap = x->v;
+     char nextdelim=0;
      for (int i=x->n; i--; ap++) {
!     	if (ap->a_type != A_SEMI && ap->a_type != A_COMMA && nextdelim) buf << (char)nextdelim;
!         atom_ostream(ap,buf);
!         nextdelim = ap->a_type == A_SEMI ? '\n' : ' ';
      }
!     if (nextdelim) buf << (char)nextdelim;
!     *bufp = strdup(buf.str().data());
!     *lengthp = buf.str().size();// - (nextdelim == ' ');
  }
  
***************
*** 1809,1813 ****
          case A_COMMA:   SETSYMBOL(ap, gensym(",")); break;
          case A_DOLLAR:  sprintf(tbuf, "$%ld", ap->a_index); SETSYMBOL(ap, gensym(tbuf)); break;
!         case A_DOLLSYM: atom_string(ap, tbuf, MAXPDSTRING); SETSYMBOL(ap, gensym(tbuf)); break;
          case A_SYMBOL:
              /* FIXME make this general */
--- 1802,1809 ----
          case A_COMMA:   SETSYMBOL(ap, gensym(",")); break;
          case A_DOLLAR:  sprintf(tbuf, "$%ld", ap->a_index); SETSYMBOL(ap, gensym(tbuf)); break;
!         case A_DOLLSYM: {
!         	ostringstream b;
!         	atom_ostream(ap,b);
!         	SETSYMBOL(ap, gensym(b.str().data()));} break;
          case A_SYMBOL:
              /* FIXME make this general */





More information about the Pd-cvs mailing list