[gtk-server] string passing/parsing

  • From: Jim Bailey <sleepydgym@xxxxxxxxx>
  • To: gtk-server@xxxxxxxxxxxxx
  • Date: Fri, 3 Dec 2004 12:14:29 -0800 (PST)

Hi Peter,

Thanks for your reply.

> The newline *is* possible. Please consult the demo
> applications on the
> GTK-server website, especially the e-text reader.

doh! my bad

> Writing a complete parser is too much
> work, compared to the benefit you would gain; there
> are *only* 2 symbols for
> which an alternate character have to be defined.
> That is why I have implemented
> it the way it is now.

not too much work at all, as long as the clients can
use it in a sane fashion, i'd be happy to code up
anything required.

> Indeed this might be a good idea; passing the
> gtk-functions and arguments
> directly without any comma's or brackets would even
> be nicer, then the client
> language does not need any string functions to
> accomplish the catting of
> arguments, and the client code looks much better!

if the delimiters arn't embedded in the stream, then
some form of stream control would be required, like
prefixing each string with its length, e.g a function
call could look like:


it does avoid having to do any text processing, but
does require the language to have some form of strlen.

> Well, I think the CLisp community would be more than
> happy to know how you bind
> with GTK2 using CLisp. The only binding I am aware
> of is mentioned at
> http://tenkan.org/clgtk/, which still is beta stage.

That sounds like a challenge! After looking at your
code, I saw that the guts of it came down to loading
up the right functions from the right librarys, and
calling them, and CLISP is pretty good at that.

So I gave it a go, and a few macros later I have a
bunch of function imports, and some code calling it,
and a GtkWindow on my screen. The signals/events are
tricky (because of the data variable being last, and
sometimes the second argument, sometimes the third)
but I seem to have sorted that out. I also have a
preliminary glade2 reader (takes in the save file and
builds up the widgets).

Just like everything else, its all beta, only a few
days old, I really don't have enough functions defined
to do anything useful, but the framework is there:
works for me under linux, and under windows too if you
have all the gtk dll's in the local directory.

Anyway, back to string passing. It wouldn't be too
much effort to split the work into three stages:
the network bit, that reads blocks off the input
the syntax reader - that takes blocks and works out
the function call/args
the function call dispatcher - you already have this

with that in place the syntax reader could be swapped
out with another one, controlled by command line
switches/config file. I would certainly be happy to
write a c style parser capable of accepting:
function( 42, "some string containing\" and ,\n" )

its just an idea, what do you think?



Do you Yahoo!? 
Yahoo! Mail - 250MB free storage. Do more. Manage less. 

Other related posts: