41.4 Interdependencies of the Aldor Source Files

  41.4.1 test/tcasfiles.list
  41.4.2 test/Makefile.dep
  41.4.3 Dependence on Signature Files

See Section 33.4 for a description. However, instead of generating src/asfiles.list and src/Makefile.dep we generate test/tcasfiles.list and test/Makefile.dep.

Note that test/tcasfiles.list is a superset of src/asfiles.list.

547generate interdependencies of files 466+   (458 539)  466
Makefile.dep: tcasfiles.list $(CODEFILES)
        $(PERL) $(TOOLS)/dependencies.pl \
                tcasfiles.list ${TCLIBRARYNAME} ${PROJECTROOT} > $@

tcasfiles.list: Makefile.asfiles
        $(CP) $(PROJECTROOT)/src/asfiles.list $@
        for f in ${ASFILES}; do \
          echo ${TCLIBRARYNAME} test/$$f ${TCLIBPREFIX} >> $@; \
        done

include Makefile.dep

Defines:
tcasfiles.list, used in chunks 542 and 553.

Uses ASFILES 462, asfiles.list 466, CODEFILES 432, CP 350a, PERL 427b, PROJECTROOT 346, TCLIBPREFIX 538, TCLIBRARYNAME 538, test 353, and TOOLS 423b.

41.4.1 test/tcasfiles.list

The file test/tcasfiles.list is generated via the target tcasfiles.list and given below.

myalps src/myalps/arith my  
myalps src/myalps/binpow my  
myalps src/myalps/copy my  
myalps src/myalps/prtype my  
myalps src/myalps/version my  
testcases test/myalps/binpow tc

41.4.2 test/Makefile.dep

The file test/Makefile.dep generated by tools/dependencies.pl.nw is given below. It is included into test/Makefile.nw. See also Section 33.4.2.

# Generated via  
# /home/hemmecke/SVK/HOME/trunk/projects/Software/allprose/tools/dependencies.pl \  
#   tcasfiles.list \  
#   testcases \  
#   /home/hemmecke/SVK/HOME/trunk/projects/Software/allprose  
libtestcases${LIBPOSTFIX}(tcbinpow.${FILEEXTENSION}):\  
    libmyalps${LIBPOSTFIX}(mybinpow.${FILEEXTENSION})

41.4.3 Dependence on Signature Files

See Section 29.7.2 for the concept of library variants.

A library member depends on the corresponding .as file and the explicitly in the generated file test/Makefile.dep. Furthermore it depends on a .signature.as file, see below.

Note that we must use a static pattern rule here, since only one implicit rule applies and that is given in Section 29.7.2.

549generate signature files 549  (539)  551
$(LIBALMEMBERS): ${LIB}.al(${SUBLIBPREFIX}%.ao): %.signatures.as

Uses LIB 441b and LIBALMEMBERS 443a.

We impose a certain structure on the test files so that it is possible to extract automatically the function signatures from the function implementations.

Convention 30 Test domains must start with the four letters Test in the first column. Test functions must start with test and followed by (): () == after the function name. Although not encouraged, underscores are allowed in names.

The code below checks for the pattern

testXYZ():() ==

where the pattern for XYZ allows any character that can be used in Aldor identifiers. More concretely, we test for the following Perl regular expression.

550testfunction pattern 550  (551)
^\s*test((\w|\d|\?|!|_.)+)\s*\(\s*\)\s*:\s*\(\s*\)\s*==

Uses test 353.

For example,

testAddition(): () == {  
...  
}

would be a correct definition.

Note that we include below \s* in front of #(if|else|elseif|endif) and also in front of #include because NOTANGLE might have produced the wrong indentation for the compiler directives, see Section 41.3. Furthermore, note that we copy lines that #include signature files if the filename is not identical to the .signatures.as file that is currently generated.

551generate signature files 549+   (539)  549
.PRECIOUS: %.signatures.as
%.signatures.as: %.as.nw
        $(MAKE) $(<:%.as.nw=%.as)
        $(PERL) \
            -e ’while (<>) {’\
            -e ’    if (/^\s*(#(if|else|elseif|endif).*)/) {’\
            -e ’        print "$$1\n";’\
            -e ’    } elsif (/^\s*(#include\s+"(.*\.signatures\.as)")\s*/){’\
            -e ’        if ("$$2" ne "$@") {print "$$1\n";}’\
            -e ’    } elsif (/testfunction pattern 550/) {’\
            -e ’        print "test$$1: ()->();\n";’\
            -e ’    } elsif (/^Test((\w|\d|_.)+):/) {’\
            -e ’        print "-- Test$$1\n";’\
            -e ’    }’\
            -e ’}’ $(<:%.as.nw=%.as) > $@

Uses PERL 427b and test 353.