From: Brian Inglis <Brian.Inglis@SystematicSw.ab.ca>
Subject: Re: [ANN] an EBNF parser and coding pattern tool (LGPL)
Date: 13 Feb 2003 20:03:15 GMT
Date: 2003-02-13T20:03:15+00:00 [thread overview]
Message-ID: <clcm-20030213-0007@plethora.net> (raw)
In-Reply-To: clcm-20030211-0009@plethora.net
On 12 Feb 2003 01:30:42 GMT in comp.lang.c.moderated, Hyman Rosen
<hyrosen@mail.com> wrote:
>Cedric LEMAIRE wrote:
>> The C++ compiler doesn't give you introspection to implement C++
>> templates that work on the composition of a class.
>
>Yes, this is true. To get this would require support from the
>compiler, and I imagine would look something like this - the
>result of introspect<T> for some type T would be a class with
>informative members, some of which would be like Alexandrescu's
>type lists that would carry member and base class information
>and could be processed recursively by other templates. We would
>also want an equivalent dynamic interface, so that we could take
>a polymorphic pointer or reference and deal with its introspection
>at runtime.
Macros have been used in C for years to generate generic
structures and code to process them. Define all the structure
member names and types as macro arguments calling a macro that is
a parameter of the structure definition macro, with a few extra
parameters in each level of macro for code gen arguments, e.g.
#define OBJ(B,M,E,X,Y,Z)\
B\
M(int,i,X,Y,Z)\
M(char,c,X,Y,Z)\
E
#define TD typedef struct s {
#define ETD } s
#define TN(t,n,X,Y,Z) t n;
#define O(t,n,X,Y,Z) << n
OBJ( TD, TN, ETD, , , );
OBJ( cout, O, , , , );
Extend as required.
Thanks. Take care, Brian Inglis Calgary, Alberta, Canada
--
Brian.Inglis@CSi.com (Brian dot Inglis at SystematicSw dot ab dot ca)
fake address use address above to reply
abuse@aol.com tosspam@aol.com abuse@att.com abuse@earthlink.com
abuse@hotmail.com abuse@mci.com abuse@msn.com abuse@sprint.com
abuse@yahoo.com abuse@cadvision.com abuse@shaw.ca abuse@telus.com
abuse@ibsystems.com uce@ftc.gov spam traps
--
comp.lang.c.moderated - moderation address: clcm@plethora.net
next prev parent reply other threads:[~2003-02-13 20:03 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-01-24 3:36 [ANN] an EBNF parser and coding pattern tool (LGPL) Cedric LEMAIRE
2003-01-24 16:40 ` Victor Porton
2003-01-25 0:33 ` llewelly
2003-01-29 2:55 ` Cedric LEMAIRE
2003-01-24 16:40 ` apm
2003-01-29 2:56 ` Cedric LEMAIRE
2003-01-31 2:25 ` Cedric LEMAIRE
2003-01-31 2:25 ` Anthony Williams
2003-02-01 4:10 ` Cedric LEMAIRE
2003-02-04 16:53 ` apm
2003-02-06 20:35 ` Cedric LEMAIRE
2003-02-06 20:36 ` Cedric LEMAIRE
2003-02-01 4:09 ` White Wolf
2003-02-03 1:28 ` Martin Ambuhl
2003-02-03 1:28 ` Hillel Y. Sims
2003-02-03 16:31 ` Tars_Tarkas
2003-02-03 1:29 ` Mark McIntyre
2003-02-03 16:31 ` CBFalconer
2003-02-04 16:53 ` Georg Bauhaus
2003-02-06 20:36 ` Cedric LEMAIRE
2003-02-07 17:33 ` Hyman Rosen
2003-02-08 18:22 ` Thant Tessman
2003-02-07 17:33 ` Anthony Williams
2003-02-11 6:15 ` Cedric LEMAIRE
2003-02-12 1:30 ` Hyman Rosen
2003-02-13 20:03 ` Brian Inglis [this message]
2003-02-15 20:13 ` Hyman Rosen
2003-02-15 20:14 ` Cedric LEMAIRE
2003-02-12 1:30 ` Julián Albo
2003-02-15 20:14 ` Cedric LEMAIRE
2003-02-19 6:10 ` Alan Balmer
2003-02-12 1:30 ` Stephen Leake
2003-02-12 18:22 ` Hyman Rosen
2003-02-12 19:39 ` Stephen Leake
2003-02-12 21:16 ` Hyman Rosen
2003-02-14 20:34 ` Stephen Leake
2003-02-15 20:14 ` Cedric LEMAIRE
2003-02-07 17:33 ` Hyman Rosen
2003-02-03 16:31 ` ozbear
2003-02-03 16:31 ` Cedric LEMAIRE
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox