Rev 5766 | Rev 5920 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5766 | Rev 5798 | ||
---|---|---|---|
Line 7... | Line 7... | ||
7 | <p> |
7 | <p> |
8 | A variable may be defined or modified in a variable processing file, or by |
8 | A variable may be defined or modified in a variable processing file, or by |
9 | the commands |
9 | the commands |
10 | $(ref1)cmdlist_let_&+cmd_choose=all$(ref2)cmdlist_let_">!let</a> and |
10 | $(ref1)cmdlist_let_&+cmd_choose=all$(ref2)cmdlist_let_">!let</a> and |
11 | $(ref1)cmdlist_default_&+cmd_choose=all$(ref2)cmdlist_default_">!default</a>. |
11 | $(ref1)cmdlist_default_&+cmd_choose=all$(ref2)cmdlist_default_">!default</a>. |
12 | <p> |
12 | </p><p> |
13 | Variable names can contain any alphanumeric character, as well as the |
13 | Variable names can contain any alphanumeric character, as well as the |
14 | underscore character $(emph)_$emphend. There is a limit to the length of |
14 | underscore character $(emph)_$emphend. There is a limit to the length of |
15 | variable names, and a limit to the length of values. (Limits depending on |
15 | variable names, and a limit to the length of values. (Limits depending on |
16 | server configuration.) |
16 | server configuration.) |
17 | <p> |
17 | </p><p> |
18 | Variable substitution can be done anywhere in a variable processing file or |
18 | Variable substitution can be done anywhere in a variable processing file or |
19 | a phtml file (even in the name field of a variable definition |
19 | a phtml file (even in the name field of a variable definition |
20 | line). A word preceeded by the character $emph$$$emphend |
20 | line). A word preceeded by the character $emph$$$emphend |
21 | is considered to be a variable name, and will be replaced by its value when |
21 | is considered to be a variable name, and will be replaced by its value when |
22 | the line containing it is processed. |
22 | the line containing it is processed. |
23 | <p> |
23 | </p><p> |
24 | Special rules of variable substitution: |
24 | Special rules of variable substitution: |
- | 25 | </p> |
|
25 | <ul> |
26 | <ul> |
26 | <li>If the character $emph$$$emphend is followed by a space, it will be |
27 | <li>If the character $emph$$$emphend is followed by a space, it will be |
27 | discarded. |
28 | discarded. |
28 | <li>The string $emph$$$$$emphend is replaced by a single $emph$$$emphend. |
29 | </li><li>The string $emph$$$$$emphend is replaced by a single $emph$$$emphend. |
29 | <li>If the character $emph$$$emphend is followed by the left parenthesis |
30 | </li><li>If the character $emph$$$emphend is followed by the left parenthesis |
30 | $emph($emphend, the matching $emph)$emphend will be located, the content |
31 | $emph($emphend, the matching $emph)$emphend will be located, the content |
31 | of the pair of parentheses substituted. The result of the substitution |
32 | of the pair of parentheses substituted. The result of the substitution |
32 | will then be used as the name of variable, and finally the whole thing |
33 | will then be used as the name of variable, and finally the whole thing |
33 | will be replaced by the value of the last variable. This allows nested |
34 | will be replaced by the value of the last variable. This allows nested |
34 | substitutions, as well as substitution of a variable which is followed |
35 | substitutions, as well as substitution of a variable which is followed |
Line 41... | Line 42... | ||
41 | <p> |
42 | <p> |
42 | Array addressing: if the variable $(emph)l$emphend contains a |
43 | Array addressing: if the variable $(emph)l$emphend contains a |
43 | comma-separated list $(emph)a,b,c,d,e$emphend, then the string |
44 | comma-separated list $(emph)a,b,c,d,e$emphend, then the string |
44 | <tt>$$(i[3])</tt> gives <tt>c</tt> after substitution, and |
45 | <tt>$$(i[3])</tt> gives <tt>c</tt> after substitution, and |
45 | <tt>$$(i[2 to 4])</tt> tives <tt>b,c,d</tt>, etc. |
46 | <tt>$$(i[2 to 4])</tt> tives <tt>b,c,d</tt>, etc. |
46 | <p> |
47 | </p><p> |
47 | Two-dimensional array addressing is also available: if |
48 | Two-dimensional array addressing is also available: if |
48 | <pre>$$M=x,y,z;a,b,c</pre> |
49 | <pre>$$M=x,y,z;a,b,c</pre> |
49 | (a 2x3 matrix), then |
50 | (a 2x3 matrix), then |
50 | <pre>$$(M[1;3,2])=z,y</pre> |
51 | <pre>$$(M[1;3,2])=z,y</pre> |
51 | <li>If the character $emph$$$emphend is followed by the left bracket |
52 | </li><li>If the character $emph$$$emphend is followed by the left bracket |
52 | $emph[$emphend, the matching $emph]$emphend will be located, the content |
53 | $emph[$emphend, the matching $emph]$emphend will be located, the content |
53 | of the pair of brackets substituted then evaluated to a real number value whose |
54 | of the pair of brackets substituted then evaluated to a real number value whose |
54 | precision depends on the value of $emph print_precision$emphend. |
55 | precision depends on the value of $emph print_precision$emphend. |
55 | This value will replace the whole thing |
56 | This value will replace the whole thing |
56 | together with the leading $emph$$$emphend. <br/> |
57 | together with the leading $emph$$$emphend. <br/> |
Line 60... | Line 61... | ||
60 | $(emph)a1$emphend has value $(emph)3$emphend and <br/> |
61 | $(emph)a1$emphend has value $(emph)3$emphend and <br/> |
61 | $(emph)a2$emphend has value $(emph)pi$emphend, <br/> |
62 | $(emph)a2$emphend has value $(emph)pi$emphend, <br/> |
62 | then the string<pre> |
63 | then the string<pre> |
63 | $$(a$$[$$i-1])*x+$$(a$$[$$i-2])</pre>will become<pre> |
64 | $$(a$$[$$i-1])*x+$$(a$$[$$i-2])</pre>will become<pre> |
64 | pi*x+3</pre>after substitution. |
65 | pi*x+3</pre>after substitution. |
65 | <li>If the value of a variable being substituted contains the character |
66 | </li><li>If the value of a variable being substituted contains the character |
66 | $emph$$$emphend, this value will again be substituted, until no more |
67 | $emph$$$emphend, this value will again be substituted, until no more |
67 | substitution is needed. The server has a built-in limit of nested |
68 | substitution is needed. The server has a built-in limit of nested |
68 | substitutions; infinite nested substitions will violate this limit and |
69 | substitutions; infinite nested substitions will violate this limit and |
69 | generate an error message. |
70 | generate an error message. |
- | 71 | </li> |
|
70 | </ul> |
72 | </ul> |
71 | 73 | ||
- | 74 | <p><hr/></p> |
|
72 |
|
75 | <h4>Reserved variable names</h4> |
73 | 76 | ||
74 | The following names are reserved for their special meanings. They should not be |
77 | The following names are reserved for their special meanings. They should not be |
75 | used for internal needs of any module. |
78 | used for internal needs of any module. |
76 | 79 | ||
77 | <ul> |
80 | <ul> |
78 | <li>Do not use variables with names consisting only of numbers. They are |
81 | <li>Do not use variables with names consisting only of numbers. They are |
79 | reserved for future enhancements of the language. |
82 | reserved for future enhancements of the language. |
80 | <li>Variables named |
83 | </li><li>Variables named |
81 | !for i in cmd,module,session,lang,special_parm,user,useropts,worksheet |
84 | !for i in cmd,module,session,lang,special_parm,user,useropts,worksheet |
82 | $emph$i$emphend, |
85 | $emph$i$emphend, |
83 | !next i |
86 | !next i |
84 | are reserved for special parameter passing by the user. A module's variable |
87 | are reserved for special parameter passing by the user. A module's variable |
85 | processing files or phtml files can read but cannot set them. <br/> |
88 | processing files or phtml files can read but cannot set them. <br/> |
86 | Refer to the section $emph$title_structure$emphend for the meaning of |
89 | Refer to the section $emph$title_structure$emphend for the meaning of |
87 | these variables. |
90 | these variables. |
88 | <li>The variable $emph no_name$emphend has a special use: <br/> |
91 | </li><li>The variable $emph no_name$emphend has a special use: <br/> |
89 | Parameters in the user query string with no name (for example when the |
92 | Parameters in the user query string with no name (for example when the |
90 | coordinate of a mappable image is passed this way to the http server) will |
93 | coordinate of a mappable image is passed this way to the http server) will |
91 | be registered under this variable. For this reason, it should not be used |
94 | be registered under this variable. For this reason, it should not be used |
92 | for other purposes. |
95 | for other purposes. |
93 | <li>All variable names starting with $emph wims_$emphend will have special |
96 | </li><li>All variable names starting with $emph wims_$emphend will have special |
94 | meanings for wims server. A module should read or write them only for the |
97 | meanings for wims server. A module should read or write them only for the |
95 | special meanings they are designed for. |
98 | special meanings they are designed for. |
96 | <li>Variable names starting with $emph m_$emphend are reserved for inline |
99 | </li><li>Variable names starting with $emph m_$emphend are reserved for inline |
97 | mathematical fonts. The module programmer may redefine them, but then their |
100 | mathematical fonts. The module programmer may redefine them, but then their |
98 | original meaning will be lost. |
101 | original meaning will be lost. |
99 | <li>The variable $emph module_dir$emphend has a value preset to the directory |
102 | </li><li>The variable $emph module_dir$emphend has a value preset to the directory |
100 | of the current module (with respect to the public home directory of the |
103 | of the current module (with respect to the public home directory of the |
101 | server). This value is usually $emph $$module_dir=module/$$module $emphend |
104 | server). This value is usually $emph $$module_dir=module/$$module $emphend |
102 | (but may vary with the config of the installation). |
105 | (but may vary with the config of the installation). |
103 | <li>Variable names starting with $emph module_$emphend will have special |
106 | </li><li>Variable names starting with $emph module_$emphend will have special |
104 | meanings: they are used to hold variables defined in the module's INDEX |
107 | meanings: they are used to hold variables defined in the module's INDEX |
105 | file. Currently implemented variables: |
108 | file. Currently implemented variables: |
106 | 109 | ||
107 | $table_header |
110 | $table_header |
108 | $table_tr<th> Variables</th><th>Meaning</th></tr> |
111 | $table_tr<th> Variables</th><th>Meaning</th></tr> |
Line 123... | Line 126... | ||
123 | $table_tr<td>$emph module_domain$emphend<td>algebra, analysis, geometry, ... |
126 | $table_tr<td>$emph module_domain$emphend<td>algebra, analysis, geometry, ... |
124 | $table_tr<td>$emph module_keywords$emphend<td>keywords, to be placed in the html header |
127 | $table_tr<td>$emph module_keywords$emphend<td>keywords, to be placed in the html header |
125 | $table_tr<td>$emph module_scoring$emphend<td>= yes if the module gives scores according to wims standard |
128 | $table_tr<td>$emph module_scoring$emphend<td>= yes if the module gives scores according to wims standard |
126 | $table_tr<td>$emph module_data$emphend<td>address of datamodule |
129 | $table_tr<td>$emph module_data$emphend<td>address of datamodule |
127 | 130 | ||
128 | </table |
131 | </table> |
129 | Also, variables $emph module_has_intro$emphend, |
132 | Also, variables $emph module_has_intro$emphend, |
130 | $emph module_has_help$emphend and |
133 | $emph module_has_help$emphend and |
131 | $emph module_has_about$emphend |
134 | $emph module_has_about$emphend |
132 | have value "yes" if the module's directory contains the respective |
135 | have value "yes" if the module's directory contains the respective |
133 | .phtml file. These variables are used in the command <tt>!homeref</tt>. |
136 | .phtml file. These variables are used in the command <tt>!homeref</tt>. |
134 | <li>Certain environment variables setup by httpd are readable by wims |
137 | </li><li>Certain environment variables setup by httpd are readable by wims |
135 | modules under names starting with $emph httpd_$emphend. For example, the |
138 | modules under names starting with $emph httpd_$emphend. For example, the |
136 | environment variable $emph REMOTE_HOST$emphend becomes |
139 | environment variable $emph REMOTE_HOST$emphend becomes |
137 | $emph httpd_REMOTE_HOST$emphend under wims. <br/> |
140 | $emph httpd_REMOTE_HOST$emphend under wims. <br/> |
138 | Please refer to httpd protocol specifications for details of such variables. |
141 | Please refer to httpd protocol specifications for details of such variables. |
139 | <li>All variable names starting with $emph ins_$emphend, $emph |
142 | </li><li>All variable names starting with $emph ins_$emphend, $emph |
140 | insplot_$emphend, $emph instex_$emphend will have special meanings for the |
143 | insplot_$emphend, $emph instex_$emphend will have special meanings for the |
141 | corresponding dynamic insertion engines. A module should read or write them |
144 | corresponding dynamic insertion engines. A module should read or write them |
142 | only for the special meanings they are designed for. |
145 | only for the special meanings they are designed for. |
143 | <li>If your module uses an external package (e.g. $emph pari$emphend), |
146 | </li><li>If your module uses an external package (e.g. $emph pari$emphend), |
144 | variable names starting with the name of the interface to that external |
147 | variable names starting with the name of the interface to that external |
145 | package followed by $emph _$emphend will have special meanings for that |
148 | package followed by $emph _$emphend will have special meanings for that |
146 | interface, and should be reserved for that purpose. |
149 | interface, and should be reserved for that purpose. |
- | 150 | </li> |
|
147 | </ul> |
151 | </ul> |
148 | 152 |