On Sun, 28 Oct 2007, Hans-Christoph Steiner wrote:

The tclpd API/loader has gotten me thinking about making a pure Tcl API for writing GUIs. I was thinking a bit about how to handle the Tcl code for the separate pd and pd-gui processes. Is there a way in Tcl to get the contents of a procedure and stick it into a variable?

You need to redefine proc proc in a way that calls the older proc proc and does something else with the arguments. e.g.:

rename proc oldproc
oldproc proc {name arglist body} {
  ...
  oldproc $name $arglist $body
}

I was thinking that it would be nice if the person writing the GUI object didn't have to think about the separate processes and sys_vgui.

I think it's good to not have to think about encoding and decoding values for the other side, which is why I introduced abstraction layers such as sys_mgui and pd_upload and proc netsend.

I think that inter-process synchronisation, doing things in the right order and at the right moment is such, is a lot harder to do and a lot harder to abstract. Basically, you never can fully abstract a remote procedure call in a non-blocking way, and you don't want to use the blocking way because this is a realtime app.

Instead, the tclpd API would take the functions that run on pd-gui, and handle sending them over to pd-gui via sys_vgui. So in the API, it would just look like one thing.

If you just want to upload code over the gui socket, have a wrapped sys_gui that you'd use as a block of code:

sys_gui {
  proc blah {} { ... }
  proc stuff {a b} { ... }
  ...
}

and it'll just do what it wants to do.

 _ _ __ ___ _____ ________ _____________ _____________________ ...
| Mathieu Bouchard - tél:+1.514.383.3801, Montréal QC Canada
_______________________________________________
PD-dev mailing list
[email protected]
http://lists.puredata.info/listinfo/pd-dev

Reply via email to