RE: [cedet-semantic] parser problem with C++ classes
Brought to you by:
zappo
From: <kla...@sd...> - 2006-02-21 17:41:23
|
Hi, Find,that it works now for you - enjoy code-browsing with cedet and ECB! I think i will add your problem and solution to the ECB FAQ - whereas = some steps will superfluous after stable cedet 1.0 is released.... Ciao, Klaus Ulrich Becker wrote: > Hello! >=20 > Thank you for the fix and for the tips to make it work! > It works fine indeed. >=20 >=20 > Just for the records, here are a few hints to make it work: >=20 > 1. Have, say, the latest cedet distribution. >=20 > 2. Get cedet/semantic/bovine/semantic-c.el from cvs. >=20 > 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 >=20 > or change to cedet and issue a make in your shell. >=20 > 4. Loading cedet (and ecb) takes a while. To load them on > demand, you may put the following function into your .emacs file: >=20 > (defun load-cedet+ecb () > "Load cedet tools and ecb." >=20 > (interactive) >=20 > ;; Load CEDET > (load-file "~/lisp/elisp/cedet/common/cedet.elc") >=20 > ;; 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) >=20 > ;; Enable this if you develop in semantic, or develop > grammars ;; > (semantic-load-enable-semantic-debugging-helpers)=20 >=20 > ;; Load ECB > (add-to-list 'load-path "~/lisp/elisp/ecb") > (require 'ecb) >=20 > ) > (global-set-key [(alt d)] 'load-cedet+ecb) ; have A-d to load > these develop tools=20 >=20 > 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=20 >=20 > 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.=20 >=20 > 6. Make sure to remove any semantic.cache files that may be in your > way from previous sessions!=20 >=20 > 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.=20 >=20 >=20 > hth >=20 >=20 > Best, > Ulrich >=20 >=20 > kla...@sd... wrote: >> Hi, >>=20 >> i think your mentioned option is exactly what we need to solve a >> bunch of such preprocessor-problems...=20 > > Ulrich, could you please test, if this works for you?? >>=20 >> Ciao, >> Klaus >>=20 >> Eric M. Ludlam wrote: >>> Hi, >>>=20 >>> 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. >>>=20 >>> Any such symbols added will be ignored no matter where they lie >>> in the code.=20 >>>=20 >>> Ideally, it will also perform lexical token replacement, but I >>> don't know how to do that w/ the current scheme. >>>=20 >>> Enjoy >>> Eric >>>=20 >>>>>> <kla...@sd...> seems to think that: Hi Eric, >>>>=20 >>>> 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.=20 >>>>=20 >>>> 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?? >>>>=20 >>>> Ciao, >>>> Klaus >>>>=20 >>>> Ulrich Becker wrote: >>>>> Hello, >>>>>=20 >>>>> 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.=20 >>>>>=20 >>>>> 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. >>>>>=20 >>>>> Below is an example C++ code demonstrating the problem. >>>>>=20 >>>>> I'd appreciate any help here, because I'd need this functionality >>>>> to continue using cedet tools. >>>>>=20 >>>>>=20 >>>>> Thank you >>>>> Ulrich >>>>>=20 >>>>>=20 >>>>> //--- snipp ---------- save as foobar.cpp >>>>> ------------------------------- //-*- compile-command: "make >>>>> foobar.o" -*-=20 >>>>>=20 >>>>> #ifdef _WIN32 >>>>> #define fbexport __declspec(dllexport) #else #define fbexport >>>>> #endif=20 >>>>>=20 >>>>>=20 >>>>> /// 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; >>>>> }; >>>>>=20 >>>>>=20 >>>>> /// 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; >>>>> }; >>>>>=20 >>>>>=20 >=20 >=20 > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through > log files for problems? Stop! Download the new AJAX search engine > that makes searching your log files as easy as surfing the web.=20 > DOWNLOAD SPLUNK! > = http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D103432&bid=3D230486&dat=3D= 121642 > _______________________________________________ =20 > cedet-semantic mailing list > ced...@li... > https://lists.sourceforge.net/lists/listinfo/cedet-semantic |