Re: [cedet-semantic] parser problem with C++ classes
Brought to you by:
zappo
From: Ulrich B. <uh...@fl...> - 2006-02-21 15:39:49
|
Hello! Thank you for the fix and for the tips to make it work! It works fine indeed. Just for the records, here are a few hints to make it work: 1. Have, say, the latest cedet distribution. 2. Get cedet/semantic/bovine/semantic-c.el from cvs. 3. Byte-compile it (to have access to the custom variable). Either change to cedet/semantic/bovine, start emacs, and issue the command M-x byte-compile-file RET semantic-c.el RET or change to cedet and issue a make in your shell. 4. Loading cedet (and ecb) takes a while. To load them on demand, you may put the following function into your .emacs file: (defun load-cedet+ecb () "Load cedet tools and ecb." (interactive) ;; Load CEDET (load-file "~/lisp/elisp/cedet/common/cedet.elc") ;; Enabling various SEMANTIC minor modes. See semantic/INSTALL for more ideas. ;; Select one of the following ;; (semantic-load-enable-code-helpers) ;; (semantic-load-enable-guady-code-helpers) (semantic-load-enable-excessive-code-helpers) ;; Enable this if you develop in semantic, or develop grammars ;; (semantic-load-enable-semantic-debugging-helpers) ;; Load ECB (add-to-list 'load-path "~/lisp/elisp/ecb") (require 'ecb) ) (global-set-key [(alt d)] 'load-cedet+ecb) ; have A-d to load these develop tools 5. Open Emacs in your favorite development directory and type A-d to load cedet and ecb. Open a c or c++ source or header file. Then type M-x customize-variable RET semantic-lex-c-preprocessor-symbol-map RET Enter the string that you want to be ignored as Keyword and nil as the Replacement. Save your settings for future sessions and quit emacs. 6. Make sure to remove any semantic.cache files that may be in your way from previous sessions! 7. Open emacs again, type A-d, start speedbar or ECB (M-x ecb-activate), ... and find all the classes you have been missing before. hth Best, Ulrich kla...@sd... wrote: > Hi, > > i think your mentioned option is exactly what we need to solve a bunch of such preprocessor-problems... > Ulrich, could you please test, if this works for you?? > > Ciao, > Klaus > > Eric M. Ludlam wrote: >> Hi, >> >> I always balked at writing such a thing because it was just the tip >> of getting a real preprocessor working. Naturally as I picked up >> this task again and investigated I failed to put in a full >> preprocessor. (Lack of time mostly). Unlike last time, I have >> checked in a version of semantic-c.el that has a variable for setting >> preprocessor symbols which can be ignored. The var is >> `semantic-lex-c-preprocessor-symbol-map' which is customizable. >> >> Any such symbols added will be ignored no matter where they lie in >> the code. >> >> Ideally, it will also perform lexical token replacement, but I >> don't know how to do that w/ the current scheme. >> >> Enjoy >> Eric >> >>>>> <kla...@sd...> seems to think that: >>> Hi Eric, >>> >>> IIRC this problem was already vreported sometimes or at least a >>> similar problem with slightly fifferent preprocessor keywords bevor >>> or after >>> the class keyword... Of course there can not be implemented an own >>> preprocessor to the semantic-library (at least not IMHO) but IMO a >>> lot >>> of people would be helped if we could support this special case of a >>> preprocessor macro concerning class-defnitions... So there a >>> different keywords and we can not write an own parser for each one >>> and we can >>> also not list all preprocessor keyreported until now because probably >>> there are some more. >>> >>> But - and now my question: Would it be possible to define a >>> customizable option for the c/c++-semantic library which wuld be >>> taken >>> into account by the parser - so a user could define in the option a >>> list of keywords which should be correctly ignored if placed >>> before/after the class-keyword.... Is this possible?? >>> >>> Ciao, >>> Klaus >>> >>> Ulrich Becker wrote: >>>> Hello, >>>> >>>> I am new at using the cedet and ECB tools. Using either speedbar or >>>> ECB, I found that certain classes in my C++ source code where not >>>> displayed at all. Since it occurs with both browsers and since both >>>> use semantic for the analysis, I thought I ask for help here. >>>> >>>> The problem is with handling a preprocessor macro that is required >>>> to export symbols under Windows. Under Linux it will be empty. >>>> Classes "decorated" correctly with this macro will disapear in the >>>> class listings. Classes incorrectly decorated will be displayed, >>>> but will not compile correctly. >>>> >>>> Below is an example C++ code demonstrating the problem. >>>> >>>> I'd appreciate any help here, because I'd need this functionality >>>> to continue using cedet tools. >>>> >>>> >>>> Thank you >>>> Ulrich >>>> >>>> >>>> //--- snipp ---------- save as foobar.cpp >>>> ------------------------------- //-*- compile-command: "make >>>> foobar.o" -*- >>>> >>>> #ifdef _WIN32 >>>> #define fbexport __declspec(dllexport) #else #define fbexport #endif >>>> >>>> >>>> /// Recognized by semantic and doxygen as a class, but not >>>> recognized /// by emacs syntax highlighting. <p> /// /// <b>Worse, >>>> this does not compile correctly under Windows.</b> Tried /// MinGW >>>> and original ms compilers. This is the error message /// >>>> http://msdn2.microsoft.com/en-us/library/eehkcz60.aspx /// >>>> fbexport class foo >>>> { >>>> public: >>>> int ifoo; >>>> }; >>>> >>>> >>>> /// Not recognized by semantic, but recognized by doxygen as a class >>>> /// and by emacs syntax highlighting as a variable. And this >>>> compiles /// under Windows. /// class fbexport bar { >>>> public: >>>> int ibar; >>>> }; >>>> >>>> |