The %include directive (basic information)
Suppose the file "mylib.m" contains some Miranda declarations (which
could be any kind of legal Miranda declaration, eg function definitions,
type definitions etc). To make these in scope in another script, the
latter will contain the directive
%include "mylib"
This can come anywhere in the script (there is for example no
requirement that %include directives come at the front) but must be at
top level - you may not place a %include directive inside a where
clause. The subject of a %include directive may itself contain %include
directives, and so on (to any reasonable depth).
By default, the names `exported' from an included script are all those
defined in it at top level, but not those of subsidiary %include's.
This can be modified by placing a `%export' directive in the included
script. For a discussion of this and other ways of modifying the effect
of %include see the manual section giving a detailed account of the
library directives.
If the filename in a %include directive is enclosed in angle brackets
instead of string quotes, this is understood to be a pathname relative
to the miralib directory. So for example putting in your script
%include <ex/matrix>
brings into scope the definitions exported from the matrix package in
the Miranda examples directory `ex'. (*See note below.)
Finally, note that that the relationship between includor and includee
is unsymmetrical. If file A %include's file B, then the declarations of
B are visible to A, but not vice versa.
There is a simpler (purely textual) directive
%insert "file"
which causes the contents of "file" to be substituted for the %insert
directive during lexical analysis. This can occur anywhere in a Miranda
script. See manual section on compiler directives.
------------------------------------------------------------------------
(*) Note to system administrators: an empty directory `local' is
provided under the miralib directory, in which you can place additional
libraries which you wish to make available to all Miranda users at your
site.