1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
When designing projects using modules the same approach as used with
traditional projects (using headers) can be followed. Some additional
conventions are suggested that specifically apply to modules. Filenames are just
filenames. In the annotations() following conventions are adopted:
itemization(
it() the names of files containing module- or partition-interface units
begin with tt(mod), followed by the lower-case module- or
partition-names, using tt(.cc) extensions (e.g. tt(modgroup.cc));
it() module's source files are in sub-directories having
their lower-case module names (e.g., tt(./group))
it() partitions are defined in sub-directories of their modules'
directories. E.g., if the module tt(Group) is defined in tt(./group),
than its partiton tt(Group:Support) is defined in tt(./group/support);
it() the project's main directory has a sub-directory tt(gcm.cache),
initially containing a soft-link tt(usr/) to the system's tt(/usr)
sub-directory allowing source files to import module-compiled
system header files (e.g., tt(import <iostream>;));
it() module or partition sub-directories have a soft-link tt(gcm.cache)
to tt(../gcm.cache), so all compiled module- and partition-interface
units are available in the (top-level) tt(gcm.cache) sub-directory.
)
The compiler writes compiled interface units in their tt(gcm.cache)
sub-directories. The tt(.gcm) filenames of modules are equal to the names of the
modules (e.g., for tt(Group) it is tt(Group.gcm)). The filename of
a module-compiled partition starts with its module name, followed by a dash
(tt(-)), followed by the partitions's name (e.g., for tt(Group:Support) it is
tt(Group-Support.gcm)).
To avoid overfilling interface units they should (like class headers) not
em(define) components but merely em(declare) them. Their definitions are
provided in separate source files, defined in their interface unit's
sub-directory, using the familiar the em(one component, one source file)
design principle.
|