Rev 7423 | Rev 8454 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 7423 | Rev 8367 | ||
---|---|---|---|
Line 62... | Line 62... | ||
62 | Available commands: |
62 | Available commands: |
63 | 63 | ||
64 | <pre> |
64 | <pre> |
65 | \if{condition}{if_content} |
65 | \if{condition}{if_content} |
66 | \if{condition}{if_content}{otherwise_content} |
66 | \if{condition}{if_content}{otherwise_content} |
- | 67 | \ifval{condition}{if_content} |
|
- | 68 | \ifval{condition}{if_content}{otherwise_content} |
|
67 | \for{var=n1 to n2}{loop_content} |
69 | \for{var=n1 to n2}{loop_content} |
68 | \while{condition}{loop_content} (main environment only) |
70 | \while{condition}{loop_content} (main environment only) |
69 | </pre> |
71 | </pre> |
70 | 72 | ||
71 | These commands can be used either within statement, hint, solution or |
73 | These commands can be used either within statement, hint, solution or |
Line 79... | Line 81... | ||
79 | following special methods are available: |
81 | following special methods are available: |
80 | <br /> |
82 | <br /> |
81 | !if $special_parm=all |
83 | !if $special_parm=all |
82 | !for sp in $special_list |
84 | !for sp in $special_list |
83 | <h4 class="wimscenter">The special method <span class="tt wims_code_words">$sp</span></h4> |
85 | <h4 class="wimscenter">The special method <span class="tt wims_code_words">$sp</span></h4> |
84 | General syntax: <span class="wims_code_words">\special{$sp <i>parameters</i>}</span> |
86 | General syntax: <span class="wims_code_words">\special{$sp <i>parameters</i>}</span> |
85 | <div> |
87 | <div> |
86 | 88 | ||
87 | !read oef/special/$sp.phtml help |
89 | !read oef/special/$sp.phtml help |
88 | </div> |
90 | </div> |
89 | !next sp |
91 | !next sp |
Line 113... | Line 115... | ||
113 | </p><p> |
115 | </p><p> |
114 | To use this feature, a subdirectory cpp/ should be created under src. Put |
116 | To use this feature, a subdirectory cpp/ should be created under src. Put |
115 | into it pre-source files with extension .cpp. In these files, you can add |
117 | into it pre-source files with extension .cpp. In these files, you can add |
116 | cpp directives like <span class="tt wims_code_words">#include</span>, |
118 | cpp directives like <span class="tt wims_code_words">#include</span>, |
117 | <span class="tt wims_code_words">#define</span> |
119 | <span class="tt wims_code_words">#define</span> |
118 | or <span class="tt wims_code_words">#if</span>. |
120 | or <span class="tt wims_code_words">#if</span>. |
119 | (Please refer to cpp |
121 | (Please refer to cpp |
120 | manual and c specification for details of the syntax.) |
122 | manual and c specification for details of the syntax.) |
121 | </p><p> |
123 | </p><p> |
122 | The first line of the cpp file must define a list of targets, in the format |
124 | The first line of the cpp file must define a list of targets, in the format |
123 | </p> |
125 | </p> |
Line 128... | Line 130... | ||
128 | (the extension .oef will be |
130 | (the extension .oef will be |
129 | appended to the output names). When generating the target file <em>targ1</em>, a macro |
131 | appended to the output names). When generating the target file <em>targ1</em>, a macro |
130 | <em>TARGET_targ1</em> is defined. |
132 | <em>TARGET_targ1</em> is defined. |
131 | Therefore in the cpp source file, you can add lines like |
133 | Therefore in the cpp source file, you can add lines like |
132 | <pre> |
134 | <pre> |
133 | #if defined TARGET_targ1 |
135 | #if defined TARGET_targ1 |
134 | \title{Exercise 1} |
136 | \title{Exercise 1} |
135 | \integer{v1=3} |
137 | \integer{v1=3} |
136 | \text{t1=this is target 1} |
138 | \text{t1=this is target 1} |
137 | #endif |
139 | #endif |
138 | #if defined TARGET_targ2 |
140 | #if defined TARGET_targ2 |
139 | \title{Exercise 2} |
141 | \title{Exercise 2} |
140 | \integer{v1=5} |
142 | \integer{v1=5} |
141 | \text{t1=this is target 2} |
143 | \text{t1=this is target 2} |
142 | #endif |
144 | #endif |
143 | </pre> |
145 | </pre> |
Line 159... | Line 161... | ||
159 | </p> |
161 | </p> |
160 | <div class="wims_warning"> |
162 | <div class="wims_warning"> |
161 | <span class="wims_warning">$wims_name_warning</span> : In the commands beginning by # as in |
163 | <span class="wims_warning">$wims_name_warning</span> : In the commands beginning by # as in |
162 | <span class="tt">#include</span>, the character <span class="tt">#</span> must be the |
164 | <span class="tt">#include</span>, the character <span class="tt">#</span> must be the |
163 | first character of the line. You must not |
165 | first character of the line. You must not |
164 | use <span class="tt">#</span> as a character comment. |
166 | use <span class="tt">#</span> as a character comment. |
165 | </div> |
167 | </div> |
166 | 168 | ||
167 | 169 | ||
168 | <h3>Exercise environment</h3> |
170 | <h3>Exercise environment</h3> |
169 | A special variable <span class="tt wims_code_variable">\oefenv</span> can be used to test the environment of |
171 | A special variable <span class="tt wims_code_variable">\oefenv</span> can be used to test the environment of |
170 | an exercise (if it is not redefined within the exercise). |
172 | an exercise (if it is not redefined within the exercise). |
171 | <p> |
173 | <p> |
172 | For the time being, the only testable content of the variable is the word |
174 | For the time being, the only testable content of the variable is the word |
173 | ``debug''. This word appears within <span class="tt wims_code_variable">\oefenv</span> in the following |
175 | ``debug''. This word appears within <span class="tt wims_code_variable">\oefenv</span> in the following |
174 | situations: |
176 | situations: |
175 | </p><ol> |
177 | </p><ol> |
176 | <li>When it is executed within Createxo.</li> |
178 | <li>When it is executed within Createxo.</li> |
177 | <li>When it is under test in Modtool, by the developer himself.</li> |
179 | <li>When it is under test in Modtool, by the developer himself.</li> |
178 | <li>When it is a class exercise and is executed by the supervisor.</li> |
180 | <li>When it is a class exercise and is executed by the supervisor.</li> |
179 | </ol> |
181 | </ol> |