Loading in Your C/C++ CodeOnce you have created an empty new project, there are three main steps for populating the new database with information about the source code that you want to analyze.
1. Select and configure a compiler configuration fileImagix 4D's source analyzer itself does a compiler independent semantic analysis of your source code. Through compiler configuration files, the analyzer is extended so that it behaves like your compiler. The result of this is that Imagix 4D's analysis of your software matches that of your compiler.
Selecting and configuring a compiler configuration file is a one-time activity. You can use the resulting configuration file to load in any of your source code that you compile with that compiler.
2. Specify your source files and how to analyze themThe central step in importing your source code into Imagix 4D is having the tool analyze your source code. The Imagix 4D analyzer semantically parses your code, much like a compiler. Just like with a compiler, you'll pass it a list of source files, along with a list of options indicating where to look for include files, and what macro definitions to use in the analysis. Whereas a compiler generates object files that are later linked into an executable, the Imagix 4D analyzer creates data files, which are later loaded and integrated in the Imagix 4D database.
For C and C++ code, there are a several different approaches available for specifying your source code and how to analyze it.
If you have an environment where you can compile your code, the recommended approach is to capture the commands sent to the compiler, and derive commands for the Imagix 4D source analyzer based on those commands. While compiling your code, you may have a way to directly capture the build-issued commands into a build log file. If not, you can use the imagix-cc-monitor utility to monitor system commands and capture any compiler invocations to a file. Whichever way you generate the build log file, this approach automatically processes that file, analyzing the compiler invocations, and identifing the source file and -I, -D and -U arguments passed to the compiler. Applying this information, a series of data source entries are defined, one for each group of source files sharing similar flags. These are the same data source entries that you would fill out manually in the Dialog-Based (C/C++) approach. By populating them automatically from the build log, you are insured that the settings match how your compiler analyzes the code.
Recommended if you can compile your source code
A second approach is specific to Microsoft Visual Studio (MSVC) projects and solutions. It extracts the file and preprocessor flag information directly from the makefile, .dsp, .vcproj or .vcxproj file created by Visual Studio. For solutions (called workspaces prior to the .NET version), .dsw or .sln files are read.
Recommended if you can't compile your code, but you already have Microsoft Visual Studio projects defined for the code
A third approach is the most generic. It also involves filling out a dialog, but here it is done manually. In the dialog, you'll specify:
-- the directory where the source files are located
Recommended if neither Extract from Build Log nor Import from Microsoft Visual Studio apply
A final approach uses your make system actively rather than passively, by adding targets to your makefiles. Since your makefile contains information about source files and preprocessor flags, this fourth approach leverages the already existing definitions. While the makefile approach offers some advantages in on-going production use of the tool, it is generally much more difficult to get started with, and is not recommended for initial evaluation of the tool.
Recommended only if dialog-based approach does not yield sufficient precision
3. Adjust the project settings to refine the analysis resultsOnce you have defined your project settings and started the analyzer, any issues encountered by the analyzer will be reported to the Analyzer Results window. You can use these reported results to fine-tune your project settings and achieve a more precise representation of your software.