So re-reading my first reply it becomes clear that this was much too
terse - sorry.

Here  then the longer explanation:

At the lowest level katcp is a line-based protocol consisting out of lines
starting with either '#', '?', '!', followed by one or more words, each
word separated from the subsequent one by one or more spaces or tabs.

Generally katcp is intended to be human readable, so where possible the words
should be plain (ascii) text, but where not[1] katcp offers the
following backslash
escapes '\\' '\n', '\r', '\t', '\0', '\e', '\@' and '\_'. The first five
of these escapes are the same as C. The other three require some
explanation:

'\_' is interesting as it decodes to a *space*, so ' ', not an underscore. The
reason for that is that it means a naive parser unaware of escapes at least
still manages to extract the correct word.

  ?hello paramter1 parameter\_two parameter3

will yield 'parameter3' to the quick and dirty parser (say "cut -f4 -d
' ')  which
simply splits on space, rather than 'two' if this were not the case.

'\e' escapes the 27 (0x1b) as a curtesy, so that binary data displayed
to the terminal doesn't generate too many escape sequences.

'\@' is the null parameter - so represents a word of zero length or
nothing. This means
it is possible to have optional parameters not just at the end of list, so
making it easier to refer to parameterN, even if nothing is given for
parameterN-1.

It is possible to think about each word/parameter has having a type,
and while that might be
useful in a number of cases, say when binding it to a strongly typed
language, at this
level they are all just a sequence of octets...

regards

marc

[1] - It is always good to offer an escape - not only to cornered wild
animals, but to other programmers too :) There is an ancient famous critique of
Pascal which takes it to task for not providing this.

-- 
You received this message because you are subscribed to the Google Groups 
"[email protected]" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/a/lists.berkeley.edu/d/msgid/casper/CAGrhWaS%3D-1kECGh2gs1a5JWF%2B8nHfNeJ%2B9_BTeuRh7wxngvQcw%40mail.gmail.com.

Reply via email to