Statistiques
| Révision :

root / tmp / org.txm.setups / nsis-2.5 / Examples / LogicLib.nsi @ 3115

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

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