--On Wednesday, May 23, 2001 9:52 PM +0100 Nix <nix(a)esperi.demon.co.uk>
wrote:
I'm going to stitch this in after the preprocessor has run on a
given
source file. (I'd have to preprocess it anyway, so it seems sensible
to only preprocess it once!)
Oh, FWIW the preprocessor should be able to handle just about
anything, 'cos I'm cheating. I'm taking c-parse.y and cpplex.c from
GCC, and tearing them down into something that can unambiguously spot
C blocks (`stmts_and_decls'), assignments (`expr_no_commas'),
Lisp_Object variable declarations (`decl' nodes), and temporaries.
Everything else that I can throw away I will; we don't need a
complete C parser, let alone the Objective C parts (sorry, Ovidiu ;)
).
In one respect it'll be more complicated than GCC's parser; it needs
to maintain knowledge of where in the pre-lexed sources a given
lexical component comes from, so we can rewrite the temporaries; but
it shouldn't be terribly hard. (I think GCC also contains some
temporary-rewriting stuff I can pinch from; building a temporary is an
RTL-level equivalent of what this preprocessor would have to do on the
source code level.
Fun. (But if this were C++ it would not be fun, it would be
torment...)
Yes, I can imagine it would be. I would certainly hate to do anything
that would heavily penalize the use of C++ in XEmacs or worse yet, make
it impossible.
Also don't forget about the native Windows build using MSVC while
thinking about this. Nothing you've said so far jumps out as being
impossible, but that's a rather different environment with a different
C compiler and preprocessor to worry about.
Mike Alexander mailto:mtaï¼ arbortext.com
Arbortext, Inc. +1-734-997-0200