blob: c53c3f0e2c45acb9e9a4f6053a11d14b0549717f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
_T_h_e_ _%_i_n_c_l_u_d_e_ _d_i_r_e_c_t_i_v_e_ _(_b_a_s_i_c_ _i_n_f_o_r_m_a_t_i_o_n_)
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
%_i_n_c_l_u_d_e "mylib"
This can come anywhere in the script (there is for example no
requirement that %_i_n_c_l_u_d_e directives come at the front) but must be at
top level - you may not place a %_i_n_c_l_u_d_e directive inside a _w_h_e_r_e
clause. The subject of a %_i_n_c_l_u_d_e directive may itself contain %_i_n_c_l_u_d_e
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 %_i_n_c_l_u_d_e's.
This can be modified by placing a `%_e_x_p_o_r_t' directive in the included
script. For a discussion of this and other ways of modifying the effect
of %_i_n_c_l_u_d_e see the manual section giving a detailed account of the
library directives.
If the filename in a _%_i_n_c_l_u_d_e 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
%_i_n_c_l_u_d_e <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 %_i_n_c_l_u_d_e's file B, then the declarations of
B are visible to A, but not vice versa.
There is a simpler (purely textual) directive
%_i_n_s_e_r_t "file"
which causes the contents of "file" to be substituted for the %_i_n_s_e_r_t
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.
|