[gtk-server] Re: string passing/parsing

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

Greetings,

> (gtk_func "gtk_text_buffer_insert" buffer iter
> "Hello world" -1)

That's an s-expression, I like s-expressions. So much
so that I have just put together this parser:
http://dgym.homeunix.net/dumb-parser.c

it is capable of being given the input in chunks, so
doesn't have any limitations on size. as it reads
through the expression, it builds up a list of every
form inside it, e.g.
["gtk_func" "gtk_text_buffer_insert" "buffer" "iter"
"Hello world" "-1"]
and when it gets to the end, it currently just prints
them out, but you know what to do with them.

anything in " quotes can take literal characters
(other than '"' and '\') and it also expands the
following:
\" -> "
\n -> newline
\r -> return
\\ -> \
\t -> tab

does that cover everything needed for client -> server
messages? apart from the escaping, all the languages
should be fine with that format, and it still looks
natural (to a lisp programmer).

please forgive the shoddy code, i'm a bit rusty when
it comes to C, but it compiles and the tests run, so
what could possibly go wrong :)

good night,

from the not so cold UK.

Jim


                
__________________________________ 
Do you Yahoo!? 
The all-new My Yahoo! - Get yours free! 
http://my.yahoo.com 
 


Other related posts: