Tutorial 2: Projects and files
In the previous tutorial Chic automatically found the include
directives and forward declarations needed to produce a
self-consistent header file. In this section we'll look at how to set
up Chic so that it finds the correct dependencies.
Selecting the files
At any time Chic works on one project. Each project is composed of a
number of hic-files and header files. These files can either be
individually selected or they can be indicated as all the files with
certain suffixes in a given directory. If you click on the menu
button "Edit->Project files" in the GUI, the project files widget will
pop up showing the files in the current directory. By right clicking
a file or directory you can select or unselect it. If you select a
directory you effectively select all the files in that directory which
have a suffix that's a predefined suffix for either hic-files or
header files. That's the simplest and the most common way to set up a
project. Selecting individual files is not often necessary other than
when selecting the C++ standard files. There are also other more advanced selection criteria
You can select both header files and hic-files. Normally you only
select headers that have not been generated from a hic-file. When you
have a hic-file you select that instead. If you select both the
hic-file and the header that was generated from it, Chic will figure
this out and use the hic-file.
Updating the database
After selecting the files, it's time to extract the necessary
information from them. Clicking on the menu item "Actions->Update
all" tells Chic to scan all selected files and put the information it
needs into the database.
During the scan Chic follows the include directives it encounters in
order to expand macros. It searches for files in the directories
specified by a path parameter. As most parameters in Chic, the path
parameter can be specified for the whole project, the files in a given
directory or for individual files. The parameters section describes
Chic's parameter model. There you also find documentation of other
parameters that can be used to control the update.
If Chic can't find an #included file, it simply ignores it. As long
as the missing file does not define or alter macros that are needed
for subsequent parsing, this is harmless.
The time a full update takes depends of course on how many files that
are selected. But the number of files that are included from these is
equally important. Anyway, for a few dozens of files it shouldn't
take too many seconds on an average PC.
That's actually all there is to setting up the database. If you wish,
you can add or remove files from the database by selecting or
unselecting files and subsequently tell Chic to update the whole
database or only the part that changed. If you alter the file system
by for example removing or adding files you can tell Chic to update
itself on the part that was modified. When you generate compile files
from a hic-file, Chic automatically updates its view of that file so
it's not often you need to explicitly tell Chic to perform an update.
- You can select individual files or you can select
all files with some given suffixes in a directory
- After you have modified one or more files
you tell Chic to re-parse those files
- When you generate a file, Chic updates the file first