Eric M. Ludlam | 2 Oct 2009 06:17
Gravatar

Re: Smart completion for wxWidgets

On Fri, 2009-10-02 at 00:31 +0200, David Engster wrote:
> Eric M. Ludlam <eric <at> siege-engine.com> writes:
> > Once this is worked out, it would be great to add the configuration
> > ideas to the CEDET manual so others can configure wxwidgets more easily.
> > I know there are hints out there for Qt and gtk too.  It would be great
> > if we could start collecting those in the manual, or perhaps on
> > emacswiki.
> 
> I think the EmacsWiki would be the best place for this.
> 
> However, it would also be great if these kinds of tweaks would not be
> necessary. From the different C++ libraries I tried, parsing usually
> failed because of some preprocessor trickery, and usually it was either
> 
> a) a macro in a class definition, like
> 
>       class SOMESYMBOL myClass;
> 
>    with SOMESYMBOL usually some compiler attribute, or
> 
> b) macros to start or end a namespace, like
> 
>       #define BEGIN_NS namespace mynamespace {
>       #define END_NS }
> 
>    We have code for this for GLIBC and the Visual C++ STL, but I've seen
>    other libraries which use macros like these.
> 
> > Perhaps one of the 'describe includes' type functions could recognize
> > some special headers, and provide suggestions on a good configuration
> > too.
> 
> It'd be great to have some tool which detects stuff like this and
> automatically does The Right Thing. For example, setting SOMESYMBOL to
> nil, or creating lexers for the begin/end namespace thing. However, I
> could imagine this to be quite a difficult problem to solve. Maybe it's
> not worth the time.

It was my intention to teach the preprocessor to really "include" things
from include files.  You can see hints of this in semantic-lex-spp.el
with an old use-header-flag I never hooked up.  There were just too many
things that could go wrong from a configuration standpoint to start
bootstrapping that utility.

I would expect that, at least for Automake based projects, it should be
possible for EDE to seed things like the include path, preprocessor
symbol files (from some list of well known packages).  The basic
infrastructure is there for EDE and Semantic to share this info.  EDE
just needs code to derive the info from the Makefiles.

The namespace start/end macros are indeed a big issue.  Real lexers
provide a token stream, and CPP runs off, and modifies the token stream.
Unfortunately for semantic-lex, it was designed to run out of a buffer
using Emacs built-in optimizations, and does not extend well to this
concept, which is why the { and } in the two macros never seem to line
up.  Both need to be in a buffer to be correctly identified.  There are
some funky things you can do with text properties that might help, but I
hadn't ever gotten around to trying it out.

Eric

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf

Gmane