[L2Ork-dev] request for mentorship: comment parsing

Jonathan Wilkes jon.w.wilkes at gmail.com
Sun Apr 29 19:55:49 EDT 2018


Ok, I've got a rough spec for a solution:

1. Add a creator for "text_class"-- let's call it "text2"

2. Change the GUI so that creating a "Put" menu comment creates a
"text2" instead of a "text"

3. On text_save, let's save our text objects with selector "text2" if that
was our creator at instantiation time.

4. When user inputs some text inside a "text2" in the GUI and tries to
instantiate, the GUI splits the string into an array of characters and
then maps each of those characters to one or more bytes using
TextEncoder

5. The GUI sends "text2" a list of bytes

6. Pd receives the "text2" message and saves them to its buf.

7. Now, we've got a choice. We can either fudge around rtext_senditup,
or we can make a special case in the GUI to use TextDecoder on the list
of bytes we receive from Pd. I'm not sure how we signal our special case--
we might be able to just query the <g> we belong to for a "text2" class
or something like that.

I just wrote this very quick, but it should cover:

* displaying arbitrary comment content in GUI
* sending arbitrary comment content GUI->Pd
* storing it in Pd
* saving it in Pd
* sending it from Pd->GUI

A nice side effect is that we'd get newlines and multiple contiguous
spaces for free. :)

Thoughts?

-Jonathan


More information about the L2Ork-dev mailing list