[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 6-bit coding
-----BEGIN PGP SIGNED MESSAGE-----
At 10:36 PM 4/16/97 EDT, Ron Rivest wrote:
>
>Carl --
>
>I like your idea of restricting the 6-bit to handle only balanced
>S-expressions underneath. Here is a simple way to handle this that I
>thought of:
>
>* Keep a running count of how many "mode-switches" there have been
> (e.g. 8-bit to 6-bit, or vice versa). Each region of input can be
> identified with the corresponding count.
>
>* When parsing a list, note the count at the time you scan the
> "(", and also when you scan the ")". Compare these and check
> that they are the same.
>
>This is sufficient to avoid having funny parenthesizations
>happening inside a base-64 blob that you don't see.
>
>You could extend this to check the first and last character of tokens
>or raw strings, but I don't think that is necessary, and may be
>even undesirable...
>
>Does this work for you?
Ron,
I was about to describe how I would write this code and realize it's easier
to write and post it. So, let me do that.
In short, I will write two sets of parsing routines -- one set taking a C
stream for input and anther taking input from an in-memory string.
Each set will have routines which return a pointer to a C structure --
either a byte string or a linked list -- as variants of the same "object"
structure.
There will be one routine to read verbatim strings, one to read
S-expressions, one to read base64 objects.
- Carl
-----BEGIN PGP SIGNATURE-----
Version: 2.6.2
iQCVAwUBM1aRgFQXJENzYr45AQEfTQP/d+BOaYdKbOjTHCfjki/weN5+4Pn5yIfD
vdWj0CgSVcjctpV/n0TufHwoAixdrpmRxaeMq51JowqsrcpF66spHTcem4N6gl7N
mC1vmLuzcCPUaa4b3ljGknAJhD67gOaRaDmbpYPg3B+mgpjM27WrGX3MXo48bzqY
JnNGH0L4l/U=
=ce4H
-----END PGP SIGNATURE-----
References: