38.2 Build a Dependency Graph without Extensions

ToDo 26 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.

515build dependencies 515  (511a)  516
sub setDependency {
    my($f, $p) = @_;
    if ($f ne $p) {$DEP{$f}{$p}=1} #don’t add self dependence.
}

Defines:
setDependency, used in chunks 516, 517, 521, and 524.

Uses DEP 508c.

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

Extensions are treated afterwards.

516build dependencies 515+   (511a)  515
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 509a.

Uses CATEGORIES 511b, DOMAINS 511b, LIB 445, setDependency 515, and USES 512a.