Statistiques
| Révision :

root / tmp / org.txm.setups / nsis / Examples / LogicLib.nsi @ 2021

Historique | Voir | Annoter | Télécharger (12,22 ko)

1 728 mdecorde
!verbose 2
2 728 mdecorde
3 728 mdecorde
Name "NSIS LogicLib Example"
4 728 mdecorde
OutFile "LogicLib.exe"
5 728 mdecorde
ShowInstDetails show
6 728 mdecorde
RequestExecutionLevel user
7 728 mdecorde
8 728 mdecorde
!include "LogicLib.nsh"
9 728 mdecorde
10 728 mdecorde
;!undef LOGICLIB_VERBOSITY
11 728 mdecorde
;!define LOGICLIB_VERBOSITY 4   ; For debugging - watch what logiclib does with your code!
12 728 mdecorde
13 728 mdecorde
Page components "" "" ComponentsLeave
14 728 mdecorde
Page instfiles
15 728 mdecorde
16 728 mdecorde
Section /o "Run tests" TESTS
17 728 mdecorde
18 728 mdecorde
  ; kinds of if other than "value1 comparison value2"
19 728 mdecorde
  ClearErrors
20 728 mdecorde
  FindFirst $R1 $R2 "$PROGRAMFILES\*"
21 728 mdecorde
  ${Unless} ${Errors}
22 728 mdecorde
    ${Do}
23 728 mdecorde
      ${Select} $R2
24 728 mdecorde
        ${Case2} "." ".."
25 728 mdecorde
          ; Do nothing
26 728 mdecorde
        ${CaseElse}
27 728 mdecorde
          DetailPrint "Found $PROGRAMFILES\$R2"
28 728 mdecorde
      ${EndSelect}
29 728 mdecorde
      FindNext $R1 $R2
30 728 mdecorde
    ${LoopUntil} ${Errors}
31 728 mdecorde
    FindClose $R1
32 728 mdecorde
  ${EndUnless}
33 728 mdecorde
34 728 mdecorde
  ${If} ${FileExists} "${__FILE__}"
35 728 mdecorde
    DetailPrint 'Source file "${__FILE__}" still exists'
36 728 mdecorde
  ${Else}
37 728 mdecorde
    DetailPrint 'Source file "${__FILE__}" has gone'
38 728 mdecorde
  ${EndIf}
39 728 mdecorde
40 728 mdecorde
  ; if..endif
41 728 mdecorde
  StrCpy $R1 1
42 728 mdecorde
  StrCpy $R2 ""
43 728 mdecorde
  ${If} $R1 = 1
44 728 mdecorde
    StrCpy $R2 $R2A
45 728 mdecorde
  ${EndIf}
46 728 mdecorde
  ${If} $R1 = 2
47 728 mdecorde
    StrCpy $R2 $R2B
48 728 mdecorde
  ${EndIf}
49 728 mdecorde
  ${If} $R1 < 2
50 728 mdecorde
    StrCpy $R2 $R2C
51 728 mdecorde
  ${EndIf}
52 728 mdecorde
  ${If} $R1 < -2
53 728 mdecorde
    StrCpy $R2 $R2D
54 728 mdecorde
  ${EndIf}
55 728 mdecorde
  ${If} $R1 > 2
56 728 mdecorde
    StrCpy $R2 $R2E
57 728 mdecorde
  ${EndIf}
58 728 mdecorde
  ${If} $R1 > -2
59 728 mdecorde
    StrCpy $R2 $R2F
60 728 mdecorde
  ${EndIf}
61 728 mdecorde
  ${If} $R1 <> 1
62 728 mdecorde
    StrCpy $R2 $R2G
63 728 mdecorde
  ${EndIf}
64 728 mdecorde
  ${If} $R1 <> 2
65 728 mdecorde
    StrCpy $R2 $R2H
66 728 mdecorde
  ${EndIf}
67 728 mdecorde
  ${If} $R1 >= 2
68 728 mdecorde
    StrCpy $R2 $R2I
69 728 mdecorde
  ${EndIf}
70 728 mdecorde
  ${If} $R1 >= -2
71 728 mdecorde
    StrCpy $R2 $R2J
72 728 mdecorde
  ${EndIf}
73 728 mdecorde
  ${If} $R1 <= 2
74 728 mdecorde
    StrCpy $R2 $R2K
75 728 mdecorde
  ${EndIf}
76 728 mdecorde
  ${If} $R1 <= -2
77 728 mdecorde
    StrCpy $R2 $R2L
78 728 mdecorde
  ${EndIf}
79 728 mdecorde
  ${If} $R2 == "ACFHJK"
80 728 mdecorde
    DetailPrint "PASSED If..EndIf test"
81 728 mdecorde
  ${Else}
82 728 mdecorde
    DetailPrint "FAILED If..EndIf test"
83 728 mdecorde
  ${EndIf}
84 728 mdecorde
85 728 mdecorde
  ; if..elseif..else..endif
86 728 mdecorde
  StrCpy $R1 A
87 728 mdecorde
  StrCpy $R2 ""
88 728 mdecorde
  ${If} $R1 == A
89 728 mdecorde
    StrCpy $R2 $R2A
90 728 mdecorde
  ${ElseIf} $R1 == B
91 728 mdecorde
    StrCpy $R2 $R2B
92 728 mdecorde
  ${ElseUnless} $R1 != C
93 728 mdecorde
    StrCpy $R2 $R2C
94 728 mdecorde
  ${Else}
95 728 mdecorde
    StrCpy $R2 $R2D
96 728 mdecorde
  ${EndIf}
97 728 mdecorde
  ${If} $R1 == D
98 728 mdecorde
    StrCpy $R2 $R2D
99 728 mdecorde
  ${ElseIf} $R1 == A
100 728 mdecorde
    StrCpy $R2 $R2A
101 728 mdecorde
  ${ElseUnless} $R1 != B
102 728 mdecorde
    StrCpy $R2 $R2B
103 728 mdecorde
  ${Else}
104 728 mdecorde
    StrCpy $R2 $R2C
105 728 mdecorde
  ${EndIf}
106 728 mdecorde
  ${If} $R1 == C
107 728 mdecorde
    StrCpy $R2 $R2C
108 728 mdecorde
  ${ElseIf} $R1 == D
109 728 mdecorde
    StrCpy $R2 $R2D
110 728 mdecorde
  ${ElseUnless} $R1 != A
111 728 mdecorde
    StrCpy $R2 $R2A
112 728 mdecorde
  ${Else}
113 728 mdecorde
    StrCpy $R2 $R2B
114 728 mdecorde
  ${EndIf}
115 728 mdecorde
  ${If} $R1 == B
116 728 mdecorde
    StrCpy $R2 $R2B
117 728 mdecorde
  ${ElseIf} $R1 == C
118 728 mdecorde
    StrCpy $R2 $R2C
119 728 mdecorde
  ${ElseUnless} $R1 != D
120 728 mdecorde
    StrCpy $R2 $R2D
121 728 mdecorde
  ${Else}
122 728 mdecorde
    StrCpy $R2 $R2A
123 728 mdecorde
  ${EndIf}
124 728 mdecorde
  ${If} $R2 == "$R1$R1$R1$R1"
125 728 mdecorde
    DetailPrint "PASSED If..ElseIf..Else..EndIf test"
126 728 mdecorde
  ${Else}
127 728 mdecorde
    DetailPrint "FAILED If..ElseIf..Else..EndIf test"
128 728 mdecorde
  ${EndIf}
129 728 mdecorde
130 728 mdecorde
  ; if..andif..orif..endif
131 728 mdecorde
  StrCpy $R2 ""
132 728 mdecorde
  ${If} 1 = 1
133 728 mdecorde
  ${AndIf} 2 = 2
134 728 mdecorde
    StrCpy $R2 $R2A
135 728 mdecorde
  ${Else}
136 728 mdecorde
    StrCpy $R2 $R2B
137 728 mdecorde
  ${EndIf}
138 728 mdecorde
  ${If} 1 = 1
139 728 mdecorde
  ${AndIf} 2 = 3
140 728 mdecorde
    StrCpy $R2 $R2B
141 728 mdecorde
  ${Else}
142 728 mdecorde
    StrCpy $R2 $R2A
143 728 mdecorde
  ${EndIf}
144 728 mdecorde
  ${If} 1 = 2
145 728 mdecorde
  ${AndIf} 2 = 2
146 728 mdecorde
    StrCpy $R2 $R2B
147 728 mdecorde
  ${Else}
148 728 mdecorde
    StrCpy $R2 $R2A
149 728 mdecorde
  ${EndIf}
150 728 mdecorde
  ${If} 1 = 2
151 728 mdecorde
  ${AndIf} 2 = 3
152 728 mdecorde
    StrCpy $R2 $R2B
153 728 mdecorde
  ${Else}
154 728 mdecorde
    StrCpy $R2 $R2A
155 728 mdecorde
  ${EndIf}
156 728 mdecorde
157 728 mdecorde
  ${If} 1 = 1
158 728 mdecorde
  ${OrIf} 2 = 2
159 728 mdecorde
    StrCpy $R2 $R2A
160 728 mdecorde
  ${Else}
161 728 mdecorde
    StrCpy $R2 $R2B
162 728 mdecorde
  ${EndIf}
163 728 mdecorde
  ${If} 1 = 1
164 728 mdecorde
  ${OrIf} 2 = 3
165 728 mdecorde
    StrCpy $R2 $R2A
166 728 mdecorde
  ${Else}
167 728 mdecorde
    StrCpy $R2 $R2B
168 728 mdecorde
  ${EndIf}
169 728 mdecorde
  ${If} 1 = 2
170 728 mdecorde
  ${OrIf} 2 = 2
171 728 mdecorde
    StrCpy $R2 $R2A
172 728 mdecorde
  ${Else}
173 728 mdecorde
    StrCpy $R2 $R2B
174 728 mdecorde
  ${EndIf}
175 728 mdecorde
  ${If} 1 = 2
176 728 mdecorde
  ${OrIf} 2 = 3
177 728 mdecorde
    StrCpy $R2 $R2B
178 728 mdecorde
  ${Else}
179 728 mdecorde
    StrCpy $R2 $R2A
180 728 mdecorde
  ${EndIf}
181 728 mdecorde
182 728 mdecorde
  ${If} 1 = 1
183 728 mdecorde
  ${AndIf} 2 = 2
184 728 mdecorde
  ${OrIf} 3 = 3
185 728 mdecorde
    StrCpy $R2 $R2A
186 728 mdecorde
  ${Else}
187 728 mdecorde
    StrCpy $R2 $R2B
188 728 mdecorde
  ${EndIf}
189 728 mdecorde
  ${If} 1 = 1
190 728 mdecorde
  ${AndIf} 2 = 3
191 728 mdecorde
  ${OrIf} 3 = 3
192 728 mdecorde
    StrCpy $R2 $R2A
193 728 mdecorde
  ${Else}
194 728 mdecorde
    StrCpy $R2 $R2B
195 728 mdecorde
  ${EndIf}
196 728 mdecorde
  ${If} 1 = 2
197 728 mdecorde
  ${AndIf} 2 = 2
198 728 mdecorde
  ${OrIf} 3 = 3
199 728 mdecorde
    StrCpy $R2 $R2A
200 728 mdecorde
  ${Else}
201 728 mdecorde
    StrCpy $R2 $R2B
202 728 mdecorde
  ${EndIf}
203 728 mdecorde
  ${If} 1 = 2
204 728 mdecorde
  ${AndIf} 2 = 3
205 728 mdecorde
  ${OrIf} 3 = 3
206 728 mdecorde
    StrCpy $R2 $R2A
207 728 mdecorde
  ${Else}
208 728 mdecorde
    StrCpy $R2 $R2B
209 728 mdecorde
  ${EndIf}
210 728 mdecorde
  ${If} 1 = 1
211 728 mdecorde
  ${AndIf} 2 = 2
212 728 mdecorde
  ${OrIf} 3 = 4
213 728 mdecorde
    StrCpy $R2 $R2A
214 728 mdecorde
  ${Else}
215 728 mdecorde
    StrCpy $R2 $R2B
216 728 mdecorde
  ${EndIf}
217 728 mdecorde
  ${If} 1 = 1
218 728 mdecorde
  ${AndIf} 2 = 3
219 728 mdecorde
  ${OrIf} 3 = 4
220 728 mdecorde
    StrCpy $R2 $R2B
221 728 mdecorde
  ${Else}
222 728 mdecorde
    StrCpy $R2 $R2A
223 728 mdecorde
  ${EndIf}
224 728 mdecorde
  ${If} 1 = 2
225 728 mdecorde
  ${AndIf} 2 = 2
226 728 mdecorde
  ${OrIf} 3 = 4
227 728 mdecorde
    StrCpy $R2 $R2B
228 728 mdecorde
  ${Else}
229 728 mdecorde
    StrCpy $R2 $R2A
230 728 mdecorde
  ${EndIf}
231 728 mdecorde
  ${If} 1 = 2
232 728 mdecorde
  ${AndIf} 2 = 3
233 728 mdecorde
  ${OrIf} 3 = 4
234 728 mdecorde
    StrCpy $R2 $R2B
235 728 mdecorde
  ${Else}
236 728 mdecorde
    StrCpy $R2 $R2A
237 728 mdecorde
  ${EndIf}
238 728 mdecorde
239 728 mdecorde
  ${If} 1 = 1
240 728 mdecorde
  ${OrIf} 2 = 2
241 728 mdecorde
  ${AndIf} 3 = 3
242 728 mdecorde
    StrCpy $R2 $R2A
243 728 mdecorde
  ${Else}
244 728 mdecorde
    StrCpy $R2 $R2B
245 728 mdecorde
  ${EndIf}
246 728 mdecorde
  ${If} 1 = 1
247 728 mdecorde
  ${OrIf} 2 = 3
248 728 mdecorde
  ${AndIf} 3 = 3
249 728 mdecorde
    StrCpy $R2 $R2A
250 728 mdecorde
  ${Else}
251 728 mdecorde
    StrCpy $R2 $R2B
252 728 mdecorde
  ${EndIf}
253 728 mdecorde
  ${If} 1 = 2
254 728 mdecorde
  ${OrIf} 2 = 2
255 728 mdecorde
  ${AndIf} 3 = 3
256 728 mdecorde
    StrCpy $R2 $R2A
257 728 mdecorde
  ${Else}
258 728 mdecorde
    StrCpy $R2 $R2B
259 728 mdecorde
  ${EndIf}
260 728 mdecorde
  ${If} 1 = 2
261 728 mdecorde
  ${OrIf} 2 = 3
262 728 mdecorde
  ${AndIf} 3 = 3
263 728 mdecorde
    StrCpy $R2 $R2B
264 728 mdecorde
  ${Else}
265 728 mdecorde
    StrCpy $R2 $R2A
266 728 mdecorde
  ${EndIf}
267 728 mdecorde
  ${If} 1 = 1
268 728 mdecorde
  ${OrIf} 2 = 2
269 728 mdecorde
  ${AndIf} 3 = 4
270 728 mdecorde
    StrCpy $R2 $R2B
271 728 mdecorde
  ${Else}
272 728 mdecorde
    StrCpy $R2 $R2A
273 728 mdecorde
  ${EndIf}
274 728 mdecorde
  ${If} 1 = 1
275 728 mdecorde
  ${OrIf} 2 = 3
276 728 mdecorde
  ${AndIf} 3 = 4
277 728 mdecorde
    StrCpy $R2 $R2B
278 728 mdecorde
  ${Else}
279 728 mdecorde
    StrCpy $R2 $R2A
280 728 mdecorde
  ${EndIf}
281 728 mdecorde
  ${If} 1 = 2
282 728 mdecorde
  ${OrIf} 2 = 2
283 728 mdecorde
  ${AndIf} 3 = 4
284 728 mdecorde
    StrCpy $R2 $R2B
285 728 mdecorde
  ${Else}
286 728 mdecorde
    StrCpy $R2 $R2A
287 728 mdecorde
  ${EndIf}
288 728 mdecorde
  ${If} 1 = 2
289 728 mdecorde
  ${OrIf} 2 = 3
290 728 mdecorde
  ${AndIf} 3 = 4
291 728 mdecorde
    StrCpy $R2 $R2B
292 728 mdecorde
  ${Else}
293 728 mdecorde
    StrCpy $R2 $R2A
294 728 mdecorde
  ${EndIf}
295 728 mdecorde
296 728 mdecorde
  ${If} $R2 == "AAAAAAAAAAAAAAAAAAAAAAAA"
297 728 mdecorde
    DetailPrint "PASSED If..AndIf..OrIf..Else..EndIf test"
298 728 mdecorde
  ${Else}
299 728 mdecorde
    DetailPrint "FAILED If..AndIf..OrIf..Else..EndIf test"
300 728 mdecorde
  ${EndIf}
301 728 mdecorde
302 728 mdecorde
  ; ifthen..|..|
303 728 mdecorde
  StrCpy $R1 1
304 728 mdecorde
  StrCpy $R2 ""
305 728 mdecorde
  ${IfThen} $R1 = 1 ${|} StrCpy $R2 $R2A ${|}
306 728 mdecorde
  ${IfThen} $R1 = 2 ${|} StrCpy $R2 $R2B ${|}
307 728 mdecorde
  ${IfNotThen} $R1 = 1 ${|} StrCpy $R2 $R2C ${|}
308 728 mdecorde
  ${IfNotThen} $R1 = 2 ${|} StrCpy $R2 $R2D ${|}
309 728 mdecorde
  ${If} $R2 == "AD"
310 728 mdecorde
    DetailPrint "PASSED IfThen test"
311 728 mdecorde
  ${Else}
312 728 mdecorde
    DetailPrint "FAILED IfThen test"
313 728 mdecorde
  ${EndIf}
314 728 mdecorde
315 728 mdecorde
  ; ifcmd..||..| and if/unless cmd
316 728 mdecorde
  StrCpy $R2 ""
317 728 mdecorde
  ${IfCmd} MessageBox MB_YESNO "Please click Yes" IDYES ${||} StrCpy $R2 $R2A ${|}
318 728 mdecorde
  ${Unless} ${Cmd} `MessageBox MB_YESNO|MB_DEFBUTTON2 "Please click No" IDYES`
319 728 mdecorde
    StrCpy $R2 $R2B
320 728 mdecorde
  ${EndUnless}
321 728 mdecorde
  ${If} $R2 == "AB"
322 728 mdecorde
    DetailPrint "PASSED IfCmd/If Cmd test"
323 728 mdecorde
  ${Else}
324 728 mdecorde
    DetailPrint "FAILED IfCmd/If Cmd test"
325 728 mdecorde
  ${EndIf}
326 728 mdecorde
327 728 mdecorde
  ; select..case..case2..case3..case4..case5..caseelse..endselect
328 728 mdecorde
  StrCpy $R1 1
329 728 mdecorde
  StrCpy $R2 ""
330 728 mdecorde
  ${Select} $R1
331 728 mdecorde
    ${Case} "1"
332 728 mdecorde
      StrCpy $R2 $R2A
333 728 mdecorde
    ${Case} "2"
334 728 mdecorde
      StrCpy $R2 $R2B
335 728 mdecorde
    ${Case2} "3" "4"
336 728 mdecorde
      StrCpy $R2 $R2C
337 728 mdecorde
    ${CaseElse}
338 728 mdecorde
      StrCpy $R2 $R2D
339 728 mdecorde
  ${EndSelect}
340 728 mdecorde
  ${Select} $R1
341 728 mdecorde
    ${Case} "2"
342 728 mdecorde
      StrCpy $R2 $R2A
343 728 mdecorde
    ${Case} "3"
344 728 mdecorde
      StrCpy $R2 $R2B
345 728 mdecorde
    ${Case2} "4" "5"
346 728 mdecorde
      StrCpy $R2 $R2C
347 728 mdecorde
    ${CaseElse}
348 728 mdecorde
      StrCpy $R2 $R2D
349 728 mdecorde
  ${EndSelect}
350 728 mdecorde
  ${Select} $R1
351 728 mdecorde
    ${Case} "3"
352 728 mdecorde
      StrCpy $R2 $R2A
353 728 mdecorde
    ${Case} "4"
354 728 mdecorde
      StrCpy $R2 $R2B
355 728 mdecorde
    ${Case2} "5" "1"
356 728 mdecorde
      StrCpy $R2 $R2C
357 728 mdecorde
    ${CaseElse}
358 728 mdecorde
      StrCpy $R2 $R2D
359 728 mdecorde
  ${EndSelect}
360 728 mdecorde
  ${Select} $R1
361 728 mdecorde
    ${Case} "4"
362 728 mdecorde
      StrCpy $R2 $R2A
363 728 mdecorde
    ${Case} "5"
364 728 mdecorde
      StrCpy $R2 $R2B
365 728 mdecorde
    ${Case2} "1" "2"
366 728 mdecorde
      StrCpy $R2 $R2C
367 728 mdecorde
    ${CaseElse}
368 728 mdecorde
      StrCpy $R2 $R2D
369 728 mdecorde
  ${EndSelect}
370 728 mdecorde
  ${If} $R2 == "ADCC"
371 728 mdecorde
    DetailPrint "PASSED Select..Case*..EndSelect test"
372 728 mdecorde
  ${Else}
373 728 mdecorde
    DetailPrint "FAILED Select..Case*..EndSelect test"
374 728 mdecorde
  ${EndIf}
375 728 mdecorde
376 728 mdecorde
  ; switch..case..caseelse..endswitch
377 728 mdecorde
  StrCpy $R2 ""
378 728 mdecorde
  ${For} $R1 1 10
379 728 mdecorde
    ${Switch} $R1
380 728 mdecorde
      ${Case} 3
381 728 mdecorde
        StrCpy $R2 $R2A
382 728 mdecorde
      ${Case} 4
383 728 mdecorde
        StrCpy $R2 $R2B
384 728 mdecorde
        ${Break}
385 728 mdecorde
      ${Case} 5
386 728 mdecorde
        StrCpy $R2 $R2C
387 728 mdecorde
    ${EndSwitch}
388 728 mdecorde
    ${Switch} $R1
389 728 mdecorde
      ${Case} 1
390 728 mdecorde
        StrCpy $R2 $R2D
391 728 mdecorde
      ${Default}
392 728 mdecorde
        StrCpy $R2 $R2E
393 728 mdecorde
        ${Break}
394 728 mdecorde
      ${Case} 2
395 728 mdecorde
        StrCpy $R2 $R2F
396 728 mdecorde
    ${EndSwitch}
397 728 mdecorde
    ${Switch} $R1
398 728 mdecorde
      ${Case} 6
399 728 mdecorde
      ${Case} 7
400 728 mdecorde
        StrCpy $R2 $R2G
401 728 mdecorde
        ${If} $R1 = 6
402 728 mdecorde
      ${Case} 8
403 728 mdecorde
          StrCpy $R2 $R2H
404 728 mdecorde
          ${Switch} $R1
405 728 mdecorde
            ${Case} 6
406 728 mdecorde
              StrCpy $R2 $R2I
407 728 mdecorde
              ${Break}
408 728 mdecorde
            ${Case} 8
409 728 mdecorde
              StrCpy $R2 $R2J
410 728 mdecorde
          ${EndSwitch}
411 728 mdecorde
        ${EndIf}
412 728 mdecorde
        StrCpy $R2 $R2K
413 728 mdecorde
        ${Break}
414 728 mdecorde
      ${Default}
415 728 mdecorde
        StrCpy $R2 $R2L
416 728 mdecorde
      ${Case} 9
417 728 mdecorde
        StrCpy $R2 $R2M
418 728 mdecorde
    ${EndSwitch}
419 728 mdecorde
  ${Next}
420 728 mdecorde
  ${If} $R2 == "DELMFLMABELMBELMCELMEGHIKEGKEHJKEMELM"
421 728 mdecorde
    DetailPrint "PASSED Switch..Case*..EndSwitch test"
422 728 mdecorde
  ${Else}
423 728 mdecorde
    DetailPrint "FAILED Switch..Case*..EndSwitch test"
424 728 mdecorde
  ${EndIf}
425 728 mdecorde
426 728 mdecorde
  ; for[each]..exitfor..next
427 728 mdecorde
  StrCpy $R2 ""
428 728 mdecorde
  ${For} $R1 1 5
429 728 mdecorde
    StrCpy $R2 $R2$R1
430 728 mdecorde
  ${Next}
431 728 mdecorde
  ${ForEach} $R1 10 1 - 1
432 728 mdecorde
    StrCpy $R2 $R2$R1
433 728 mdecorde
  ${Next}
434 728 mdecorde
  ${For} $R1 1 0
435 728 mdecorde
    StrCpy $R2 $R2$R1
436 728 mdecorde
  ${Next}
437 728 mdecorde
  ${If} $R2 == "1234510987654321"
438 728 mdecorde
    DetailPrint "PASSED For[Each]..Next test"
439 728 mdecorde
  ${Else}
440 728 mdecorde
    DetailPrint "FAILED For[Each]..Next test"
441 728 mdecorde
  ${EndIf}
442 728 mdecorde
443 728 mdecorde
  ; do..loop
444 728 mdecorde
  StrCpy $R1 0
445 728 mdecorde
  Call DoLoop
446 728 mdecorde
  ${If} $R1 == 5
447 728 mdecorde
    DetailPrint "PASSED Do..Loop test"
448 728 mdecorde
  ${Else}
449 728 mdecorde
    DetailPrint "FAILED Do..Loop test"
450 728 mdecorde
  ${EndIf}
451 728 mdecorde
452 728 mdecorde
  ; do..exitdo..loop
453 728 mdecorde
  StrCpy $R1 0
454 728 mdecorde
  StrCpy $R2 ""
455 728 mdecorde
  ${Do}
456 728 mdecorde
    StrCpy $R2 $R2$R1
457 728 mdecorde
    IntOp $R1 $R1 + 1
458 728 mdecorde
    ${If} $R1 > 10
459 728 mdecorde
      ${ExitDo}
460 728 mdecorde
    ${EndIf}
461 728 mdecorde
  ${Loop}
462 728 mdecorde
  ${If} $R2 == "012345678910"
463 728 mdecorde
    DetailPrint "PASSED Do..ExitDo..Loop test"
464 728 mdecorde
  ${Else}
465 728 mdecorde
    DetailPrint "FAILED Do..ExitDo..Loop test"
466 728 mdecorde
  ${EndIf}
467 728 mdecorde
468 728 mdecorde
  ; do..exitdo..loopuntil
469 728 mdecorde
  StrCpy $R1 0
470 728 mdecorde
  StrCpy $R2 ""
471 728 mdecorde
  ${Do}
472 728 mdecorde
    StrCpy $R2 $R2$R1
473 728 mdecorde
    IntOp $R1 $R1 + 1
474 728 mdecorde
  ${LoopUntil} $R1 >= 5
475 728 mdecorde
  ${If} $R2 == "01234"
476 728 mdecorde
    DetailPrint "PASSED Do..ExitDo..LoopUntil test"
477 728 mdecorde
  ${Else}
478 728 mdecorde
    DetailPrint "FAILED Do..ExitDo..LoopUntil test"
479 728 mdecorde
  ${EndIf}
480 728 mdecorde
481 728 mdecorde
  ; dountil..exitdo..loop
482 728 mdecorde
  StrCpy $R1 0
483 728 mdecorde
  StrCpy $R2 ""
484 728 mdecorde
  ${DoUntil} $R1 >= 5
485 728 mdecorde
    StrCpy $R2 $R2$R1
486 728 mdecorde
    IntOp $R1 $R1 + 1
487 728 mdecorde
  ${Loop}
488 728 mdecorde
  ${If} $R2 == "01234"
489 728 mdecorde
    DetailPrint "PASSED DoUntil..ExitDo..Loop test"
490 728 mdecorde
  ${Else}
491 728 mdecorde
    DetailPrint "FAILED DoUntil..ExitDo..Loop test"
492 728 mdecorde
  ${EndIf}
493 728 mdecorde
494 728 mdecorde
  ; nested do test
495 728 mdecorde
  StrCpy $R1 0
496 728 mdecorde
  StrCpy $R2 0
497 728 mdecorde
  StrCpy $R3 ""
498 728 mdecorde
  ${Do}
499 728 mdecorde
    StrCpy $R3 $R3$R1$R2
500 728 mdecorde
    IntOp $R1 $R1 + 1
501 728 mdecorde
    ${If} $R1 > 5
502 728 mdecorde
      ${ExitDo}
503 728 mdecorde
    ${EndIf}
504 728 mdecorde
    StrCpy $R2 0
505 728 mdecorde
    ${Do}
506 728 mdecorde
      StrCpy $R3 $R3$R1$R2
507 728 mdecorde
      IntOp $R2 $R2 + 1
508 728 mdecorde
      ${If} $R2 >= 5
509 728 mdecorde
        ${ExitDo}
510 728 mdecorde
      ${EndIf}
511 728 mdecorde
    ${Loop}
512 728 mdecorde
  ${Loop}
513 728 mdecorde
  ${If} $R3 == "00101112131415202122232425303132333435404142434445505152535455"
514 728 mdecorde
    DetailPrint "PASSED nested Do test"
515 728 mdecorde
  ${Else}
516 728 mdecorde
    DetailPrint "FAILED nested Do test"
517 728 mdecorde
  ${EndIf}
518 728 mdecorde
519 728 mdecorde
  ; while..exitwhile..endwhile (exact replica of dowhile..enddo}
520 728 mdecorde
  StrCpy $R1 0
521 728 mdecorde
  StrCpy $R2 ""
522 728 mdecorde
  ${While} $R1 < 5
523 728 mdecorde
    StrCpy $R2 $R2$R1
524 728 mdecorde
    IntOp $R1 $R1 + 1
525 728 mdecorde
  ${EndWhile}
526 728 mdecorde
  ${If} $R2 == "01234"
527 728 mdecorde
    DetailPrint "PASSED While..ExitWhile..EndWhile test"
528 728 mdecorde
  ${Else}
529 728 mdecorde
    DetailPrint "FAILED While..ExitWhile..EndWhile test"
530 728 mdecorde
  ${EndIf}
531 728 mdecorde
532 728 mdecorde
  ; Unsigned integer tests
533 728 mdecorde
  StrCpy $R2 ""
534 728 mdecorde
  ${If} -1 < 1
535 728 mdecorde
    StrCpy $R2 $R2A
536 728 mdecorde
  ${EndIf}
537 728 mdecorde
  ${If} -1 U< 1
538 728 mdecorde
    StrCpy $R2 $R2B
539 728 mdecorde
  ${EndIf}
540 728 mdecorde
  ${If} 0xFFFFFFFF > 1
541 728 mdecorde
    StrCpy $R2 $R2C
542 728 mdecorde
  ${EndIf}
543 728 mdecorde
  ${If} 0xFFFFFFFF U> 1
544 728 mdecorde
    StrCpy $R2 $R2D
545 728 mdecorde
  ${EndIf}
546 728 mdecorde
  ${If} $R2 == "AD"
547 728 mdecorde
    DetailPrint "PASSED unsigned integer test"
548 728 mdecorde
  ${Else}
549 728 mdecorde
    DetailPrint "FAILED unsigned integer test"
550 728 mdecorde
  ${EndIf}
551 728 mdecorde
552 728 mdecorde
  ; 64-bit integer tests (uses System.dll)
553 728 mdecorde
  StrCpy $R2 ""
554 728 mdecorde
  ${If} 0x100000000 L= 4294967296
555 728 mdecorde
    StrCpy $R2 $R2A
556 728 mdecorde
  ${EndIf}
557 728 mdecorde
  ${If} 0x100000000 L< 0x200000000
558 728 mdecorde
    StrCpy $R2 $R2B
559 728 mdecorde
  ${EndIf}
560 728 mdecorde
  ${If} 0x500000000 L>= 0x500000000
561 728 mdecorde
    StrCpy $R2 $R2C
562 728 mdecorde
  ${EndIf}
563 728 mdecorde
  ${If} $R2 == "ABC"
564 728 mdecorde
    DetailPrint "PASSED 64-bit integer test"
565 728 mdecorde
  ${Else}
566 728 mdecorde
    DetailPrint "FAILED 64-bit integer test"
567 728 mdecorde
  ${EndIf}
568 728 mdecorde
569 728 mdecorde
  ; Extra string tests (uses System.dll)
570 728 mdecorde
  StrCpy $R2 ""
571 728 mdecorde
  ${If} "A" S< "B"
572 728 mdecorde
    StrCpy $R2 $R2A
573 728 mdecorde
  ${EndIf}
574 728 mdecorde
  ${If} "b" S> "A"
575 728 mdecorde
    StrCpy $R2 $R2B
576 728 mdecorde
  ${EndIf}
577 728 mdecorde
  ${If} "a" S<= "B"
578 728 mdecorde
    StrCpy $R2 $R2C
579 728 mdecorde
  ${EndIf}
580 728 mdecorde
  ${If} "B" S< "B"
581 728 mdecorde
    StrCpy $R2 $R2D
582 728 mdecorde
  ${EndIf}
583 728 mdecorde
  ${If} "A" S== "A"
584 728 mdecorde
    StrCpy $R2 $R2E
585 728 mdecorde
  ${EndIf}
586 728 mdecorde
  ${If} "A" S== "a"
587 728 mdecorde
    StrCpy $R2 $R2F
588 728 mdecorde
  ${EndIf}
589 728 mdecorde
  ${If} "A" S!= "a"
590 728 mdecorde
    StrCpy $R2 $R2G
591 728 mdecorde
  ${EndIf}
592 728 mdecorde
  ${If} $R2 == "ABCEG"
593 728 mdecorde
    DetailPrint "PASSED extra string test"
594 728 mdecorde
  ${Else}
595 728 mdecorde
    DetailPrint "FAILED extra string test"
596 728 mdecorde
  ${EndIf}
597 728 mdecorde
598 728 mdecorde
SectionEnd
599 728 mdecorde
600 728 mdecorde
Function ComponentsLeave
601 728 mdecorde
  ; Section flags tests (requires sections.nsh be included)
602 728 mdecorde
  ${Unless} ${SectionIsSelected} ${TESTS}
603 728 mdecorde
    MessageBox MB_OK "Please select the component"
604 728 mdecorde
    Abort
605 728 mdecorde
  ${EndIf}
606 728 mdecorde
FunctionEnd
607 728 mdecorde
608 728 mdecorde
Function DoLoop
609 728 mdecorde
610 728 mdecorde
  ${Do}
611 728 mdecorde
    IntOp $R1 $R1 + 1
612 728 mdecorde
    ${If} $R1 == 5
613 728 mdecorde
      Return
614 728 mdecorde
    ${EndIf}
615 728 mdecorde
  ${Loop}
616 728 mdecorde
617 728 mdecorde
FunctionEnd
618 728 mdecorde
619 728 mdecorde
!verbose 3