You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
DRAFT, February 18, 2003, Page 119<br />
Under "Settings" / "Compiler Settings" / "Project", select "C" or "C++" as the language. Select the current<br />
compiler environment and hit "Copy". Under the "Parsing" tab, you can specify include directories for CSD<br />
generation (one path per line, or with path separators on one line). Next, save the new or edited<br />
environment. On the settings dialog, select the new environment and hit "Use".<br />
If you have multiple project with different include paths, just create a compiler environment for each.<br />
Then, you can use jGRASP projects to easily switch between environments.<br />
25.7 Get C and C++ files with lots of ugly macros or compiler<br />
extensions to parse:<br />
If you set up the CSD generation environment (include path, predefined macros) exactly like the<br />
environment your compile command sees, and set the parse mode to "All Files", and if no structures are<br />
partly in a header file and partly in a source file (like an included function header), and if the code is ANSI<br />
C, CSD generation should work for your code. Setting all that up can be a pain, and parsing thousands of<br />
lines of headers can be slow, so this is usually not an option, unless you just want to generate a CSD<br />
once for printing or viewing.<br />
If you can edit the code, the easiest thing to do is surround weird code with #ifndef _GRASP_IGNORE<br />
and #endif . _GRASP_IGNORE is set in the predefined macros for all compiler environments by default.<br />
For example:<br />
#ifndef _GRASP_IGNORE<br />
BEGIN_MESSAGE_MAP(CPrintApp, CWinApp)<br />
ON_COMMAND(ID_SETUP, CWinApp::OnFilePrintSetup)<br />
END_MESSAGE_MAP()<br />
#endif<br />
This is an MFC message map. Without the ifndef, if all headers are parsed and the include path is set<br />
correctly, a CSD will be generated for this structure, but the indentation will not be what you expect,<br />
because the real structure is not what you expect.<br />
For compiler extensions, setting predefined macros in the compiler environment can solve many<br />
problems. For example, you might define far to be nothing in an old 16 bit compiler.<br />
For your own code, it is a good idea to use macros that look like real code. For example, you should<br />
leave a trailing semicolon out of a macro so it will be required in the code.