Macro processors

gjditchf@plg.uwaterloo.ca (Glen Ditchfield)
Wed, 21 Oct 1992 14:39:29 GMT

          From comp.compilers

Related articles
m5: macro processor Dain.Samples@UC.Edu (1992-10-20)
Macro processors gjditchf@plg.uwaterloo.ca (1992-10-21)
Macro processors psj@cix.compulink.co.uk (Peter Jefferies) (1993-08-04)
Re: Macro processors w.purvis@daresbury.ac.uk (1993-08-04)
Re: Macro processors tfj@apusapus.demon.co.uk (1993-08-04)
| List of all articles for this month |
Newsgroups: comp.compilers
From: gjditchf@plg.uwaterloo.ca (Glen Ditchfield)
Organization: University of Waterloo
Date: Wed, 21 Oct 1992 14:39:29 GMT
References: 92-10-076
Keywords: macros

Some people at Texas Instruments produced an extended C preprocessor with
a powerful macro facility that can gather text up to an arbitrary
delimiter, skipping over matched parentheses and quotes along the way,
pass the text through an arbitrary filter, and paste the result back in.
They used it to provide a fair imitation of C++'s template facility. For
instance, in


        template<class T> class Vector<T> {
T* v;
int sz;
            public:
Vector<T>(int);
T& operator[](int);
inline T& elem(int i) { return v[i]; }
        };


the "template" macro gathers up the class body and salts it away for
future instantiation.
      The last time I looked, the preprocessor (and a bunch of other stuff)
was available for anonymous ftp from csc.ti.com in /pub/COOLsomething.
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.