freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: "James K. Lowden" <jklowden AT freetds.org>
- To: freetds AT lists.ibiblio.org
- Subject: Re: [freetds] a better libtds
- Date: Mon, 22 Aug 2011 11:43:22 -0400
On Mon, 22 Aug 2011 10:53:02 -0400
Brian Bruns <brian AT bruns.com> wrote:
> If I'm understanding you correctly, you want a structure with an enum
> and essentially an array of void * to all the elements and then to use
> it you need to cast the void * back depending on the value of the
> attached datatype?
Yes, it's an array of aliases to the members of the struct. And,
because void*, they'd have to be cast.
> struct {
> uint16 flags;
> uint16 unknown;
> uint32 rowcount;
> } tds_done_inproc;
>
> tds_member_t done_in_proc_reader[] = {
> {
> offsetof(tds_done_inproc, flags),
> tds_read_uint16
> },
> {
> offsetof(tds_done_inproc, unknown),
> tds_read_uint16
> },
> {
> offsetof(tds_done_inproc, rowcount),
> tds_read_uint32
> },
> };
>
> The nice part is this is easily generated from a table of grammars,
> and you get a nice usable structure on the other end (as opposed to a
> nameless array of elements if I'm understanding you correctly), no
> casting from void * necessary. Do the same in reverse for
> writing..things like XOR key password could be a function and you just
> pass the plain text and the function pointer handles the ugly bits.
Thank you. Yes, that's the kind of thing I hope to get from the
formal grammar. Not having ever actually used a parser-generator, I
had in mind a more brute-force method. I agree the above is more
attractive.
The key is to be able to iterate over the struct elements, for both
input and output.
Regards,
--jkl
-
[freetds] a better libtds,
jklowden, 08/18/2011
-
Re: [freetds] a better libtds,
Dann Corbit, 08/18/2011
- Re: [freetds] a better libtds, James K. Lowden, 08/22/2011
-
Re: [freetds] a better libtds,
Brian Bruns, 08/18/2011
-
Re: [freetds] a better libtds,
James K. Lowden, 08/22/2011
-
Re: [freetds] a better libtds,
Brian Bruns, 08/22/2011
-
Re: [freetds] a better libtds,
James K. Lowden, 08/22/2011
-
Re: [freetds] a better libtds,
Brian Bruns, 08/22/2011
-
Re: [freetds] a better libtds,
James K. Lowden, 08/22/2011
- Re: [freetds] a better libtds, Brian Bruns, 08/22/2011
- Re: [freetds] a better libtds, Frediano Ziglio, 08/25/2011
- [freetds] git transition (Re: a better libtds), Craig A. Berry, 08/26/2011
-
Re: [freetds] a better libtds,
James K. Lowden, 08/22/2011
- Re: [freetds] a better libtds, Neuhauser, Roman (GE Capital, consultant), 08/23/2011
-
Re: [freetds] a better libtds,
Brian Bruns, 08/22/2011
-
Re: [freetds] a better libtds,
James K. Lowden, 08/22/2011
-
Re: [freetds] a better libtds,
Brian Bruns, 08/22/2011
-
Re: [freetds] a better libtds,
James K. Lowden, 08/22/2011
-
Re: [freetds] a better libtds,
Dann Corbit, 08/18/2011
- Re: [freetds] a better libtds, James K. Lowden, 08/22/2011
- Re: [freetds] a better libtds, James K. Lowden, 08/22/2011
Archive powered by MHonArc 2.6.24.