38.2 Build a Dependency Graph without Extensions

ToDo 25 Only one extension per domain is supported.

For each file f we go through the list of constructors that are used in this file as specified by the variable USES (see Section 38.1). For each of these constructors we check whether it is defined in a file p of the current project. Such definitions are given through the variables DOMAINS and CATEGORIES.

If p could be found, then f depends on p and an appropriate entry is added to the DEP hash variable.

512build dependencies 512  (507b)  513
sub setDependency {
    my($f, $p) = @_;
    if ($f ne $p) {$DEP{$f}{$p}=1} #don’t add self dependence.
}

Defines:
setDependency, used in chunks 513, 514, 518, and 521.

Uses DEP 504c.

If such a p cannot be found than the constructor is considered to be external and nothing is done.

Extensions are treated afterwards.

513build dependencies 512+   (507b)  512
sub buildDependencies {
    my($file, $LIB) = @_;
    my($LIBfile)="$LIB $file";
    my($constructor);

    for $constructor (keys %{$USES{$LIBfile}}) {
        if (exists($CATEGORIES{$constructor})) {
            &setDependency($LIBfile, $CATEGORIES{$constructor});
        } elsif (exists($DOMAINS{$constructor})) {
            &setDependency($LIBfile, $DOMAINS{$constructor});
        }
    }
}

Defines:
buildDependencies, used in chunk 505a.

Uses CATEGORIES 508a, DOMAINS 508a, LIB 441b, setDependency 512, and USES 508b.