[PD] spaces in messages (again)

Miller Puckette mpuckett at man104-1.ucsd.edu
Sat Feb 9 01:45:59 CET 2002

Sorry, there's no proper string handling in Pd, and the code you wrote
below is as good as you can probably get it.

I don't see why the "=" trick wouldn't work though.  "=" in message
boxes saves and restores fine, and if you need to save a string
internallly, just bash the spaces to "=" again as you're saving and
you should be fine.  (Save and restore works via the same message system as
those sent between objects.)

The print object uses the "postatom()" finction in s_print.c
which in turn calls atom_string() which migth be useful to you..


On Sat, Feb 09, 2002 at 12:00:27AM +0100, Olaf Matthes wrote:
> Hi list,
> I was trying to pass some text on to an external. My problem is that I
> need spaces! My first idea was to use '=' instead of spaces (since '='
> is not needed) but I realisied that pd 'steals' them from my patches.
> When I have a messagebox like [TITLE=my=stream] and save this patch all
> '=''s are converted to spaces after reloading it. So this solution works
> but makes patches 'unsaveable'.
> Then I thought about using atoms like:
> static void oggcast_comment(t_oggcast *x, t_symbol *s, t_int argc,
> t_atom* argv)
> {
>    int i = argc;
>    while(i--)
>    {
>       switch( argv->a_type) {
>          case A_FLOAT:
>          /* get numbers here, strcat() them to the rest */
>          break;
>          case A_SYMBOL:
>          /* get symbols here, strcat() them to the rest */
>          break;
>          default:
>          post("unknown type");
>       }
>       argv++;
>    }
> }
> Isn't there any other way to get plain text into my external? The above
> would just work for numbers (how to tell the difference between int and
> float?) and text. What's about special characters? ...how does [print]
> work, couldn't find the sources...
> Olaf

More information about the Pd-list mailing list