This Perl script takes a type name as a parameter and expects lines at standard input. The input file is supposed to be an Aldor source file that lists only the exports of the specific type together with their corresponding documentation as +++ pre-description. For further details see the calling sequence starting with the target generateexports.
This script extracts from the ++ description the addescription environment. If the corresponding Aldor code matches the form
FUNC:SIGNATURE;
|
the script translates such a line into
\item \adname[TYPE]{FUNC:SIGNATURE}\verb;: SIGNATURE;
|
followed by the above mentioned addescription environment. However, instead of the environment delimiters
\begin{addescription} ... \end{addescription}
|
it outputs
\begin{adshortdescription} ... \end{adshortdescription}
|
and thus takes care of the fact that in the exports list there should only appear the short description and the full description should be forgotten. The definition of the environment adshortdescription simply forgets the main contents and only outputs the short description.
At the moment a form like
<<exports: TYPE>>=
if SomeDomain has SomeCategory then { <<exports: TYPE condition 1>> } @ \begin{+++} ... \end{+++} <<exports: TYPE condition 1>>= func1: Signature1; @ \begin{+++} ... \end{+++} <<exports: TYPE condition 1>>= func2: Signature2; @ |
works reasonably well, though.
As can be seen from above, the input file is treated line by line. We associate a list of lines starting with +++ to the following line not starting by +++. Thus in the following code chunk we just store those line into the Perl variable AldorDescription. In fact, we do not store all the +++ lines but only those that correspond to an addescription environment, because we actually only need the short description for the documentation of the code lines.
Since we have treated the +++ lines with the code chunk above, it only remains to check for appropriate patterns in the remaining lines.
At the moment there are three types of lines corresponding to the if statements in the following code chunk:
In the first and second case the lines are tagged with ∖adname and ∖adtype when outputting them.
Note that we work here with the same regular expression as in Section 26.4.