Statistiques
| Révision :

root / tmp / org.txm.setups / nsis / Examples / StrFunc.nsi @ 1131

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

1 728 mdecorde
Name "NSIS StrFunc Example"
2 728 mdecorde
OutFile "StrFunc.exe"
3 728 mdecorde
ShowInstDetails show
4 728 mdecorde
ShowUninstDetails show
5 728 mdecorde
XPStyle on
6 728 mdecorde
RequestExecutionLevel user
7 728 mdecorde
8 728 mdecorde
!include "StrFunc.nsh"
9 728 mdecorde
10 728 mdecorde
# Declare used functions
11 728 mdecorde
${StrCase}
12 728 mdecorde
${StrClb}
13 728 mdecorde
${StrIOToNSIS}
14 728 mdecorde
${StrLoc}
15 728 mdecorde
${StrNSISToIO}
16 728 mdecorde
${StrRep}
17 728 mdecorde
${StrStr}
18 728 mdecorde
${StrStrAdv}
19 728 mdecorde
${StrTok}
20 728 mdecorde
${StrTrimNewLines}
21 728 mdecorde
${StrSort}
22 728 mdecorde
23 728 mdecorde
${UnStrCase}
24 728 mdecorde
${UnStrClb}
25 728 mdecorde
${UnStrIOToNSIS}
26 728 mdecorde
${UnStrLoc}
27 728 mdecorde
${UnStrNSISToIO}
28 728 mdecorde
${UnStrRep}
29 728 mdecorde
${UnStrStr}
30 728 mdecorde
${UnStrStrAdv}
31 728 mdecorde
${UnStrTok}
32 728 mdecorde
${UnStrTrimNewLines}
33 728 mdecorde
${UnStrSort}
34 728 mdecorde
35 728 mdecorde
!macro StackVerificationStart
36 728 mdecorde
  StrCpy $0 S0
37 728 mdecorde
  StrCpy $1 S1
38 728 mdecorde
  StrCpy $2 S2
39 728 mdecorde
  StrCpy $3 S3
40 728 mdecorde
  StrCpy $4 S4
41 728 mdecorde
  StrCpy $5 S5
42 728 mdecorde
  StrCpy $6 S6
43 728 mdecorde
  StrCpy $7 S7
44 728 mdecorde
  StrCpy $8 S8
45 728 mdecorde
  StrCpy $9 S9
46 728 mdecorde
  StrCpy $R0 SR0
47 728 mdecorde
  StrCpy $R1 SR1
48 728 mdecorde
  StrCpy $R2 SR2
49 728 mdecorde
  StrCpy $R3 SR3
50 728 mdecorde
  StrCpy $R4 SR4
51 728 mdecorde
  StrCpy $R5 SR5
52 728 mdecorde
  StrCpy $R6 SR6
53 728 mdecorde
  StrCpy $R7 SR7
54 728 mdecorde
  StrCpy $R8 SR8
55 728 mdecorde
  StrCpy $R9 SR9
56 728 mdecorde
!macroend
57 728 mdecorde
58 728 mdecorde
!macro StackVerificationEnd
59 728 mdecorde
  ClearErrors
60 728 mdecorde
  ${If} $1 != "S1"
61 728 mdecorde
  ${OrIf} $2 != "S2"
62 728 mdecorde
  ${OrIf} $3 != "S3"
63 728 mdecorde
  ${OrIf} $4 != "S4"
64 728 mdecorde
  ${OrIf} $5 != "S5"
65 728 mdecorde
  ${OrIf} $6 != "S6"
66 728 mdecorde
  ${OrIf} $7 != "S7"
67 728 mdecorde
  ${OrIf} $8 != "S8"
68 728 mdecorde
  ${OrIf} $9 != "S9"
69 728 mdecorde
  ${OrIf} $R0 != "SR0"
70 728 mdecorde
  ${OrIf} $R1 != "SR1"
71 728 mdecorde
  ${OrIf} $R2 != "SR2"
72 728 mdecorde
  ${OrIf} $R3 != "SR3"
73 728 mdecorde
  ${OrIf} $R4 != "SR4"
74 728 mdecorde
  ${OrIf} $R5 != "SR5"
75 728 mdecorde
  ${OrIf} $R6 != "SR6"
76 728 mdecorde
  ${OrIf} $R7 != "SR7"
77 728 mdecorde
  ${OrIf} $R8 != "SR8"
78 728 mdecorde
  ${OrIf} $R9 != "SR9"
79 728 mdecorde
    SetErrors
80 728 mdecorde
  ${EndIf}
81 728 mdecorde
!macroend
82 728 mdecorde
83 728 mdecorde
Section
84 728 mdecorde
85 728 mdecorde
  # Test case conversion
86 728 mdecorde
  !insertmacro StackVerificationStart
87 728 mdecorde
  ${StrCase} $0 "This is just an example. A very simple one." ""
88 728 mdecorde
  StrCmp $0 "This is just an example. A very simple one." 0 strcaseerror
89 728 mdecorde
  ${StrCase} $0 "THIS IS JUST AN EXAMPLE. A VERY SIMPLE ONE." "S"
90 728 mdecorde
  StrCmp $0 "This is just an example. A very simple one." 0 strcaseerror
91 728 mdecorde
  ${StrCase} $0 "This is just an example. A very simple one." "L"
92 728 mdecorde
  StrCmp $0 "this is just an example. a very simple one." 0 strcaseerror
93 728 mdecorde
  ${StrCase} $0 "This is just an example. A very simple one." "U"
94 728 mdecorde
  StrCmp $0 "THIS IS JUST AN EXAMPLE. A VERY SIMPLE ONE." 0 strcaseerror
95 728 mdecorde
  ${StrCase} $0 "This is just an example. A very simple one." "T"
96 728 mdecorde
  StrCmp $0 "This Is Just An Example. A Very Simple One." 0 strcaseerror
97 728 mdecorde
  ${StrCase} $0 "This is just an example. A very simple one." "<>"
98 728 mdecorde
  StrCmp $0 "tHIS IS JUST AN EXAMPLE. a VERY SIMPLE ONE." 0 strcaseerror
99 728 mdecorde
  ${StrCase} $0 "123456789!@#%^&*()-_=+[]{};:,./<>?" "S"
100 728 mdecorde
  StrCmp $0 "123456789!@#%^&*()-_=+[]{};:,./<>?" 0 strcaseerror
101 728 mdecorde
  ${StrCase} $0 "123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ!@#%^&*()abcdefghijklmnopqrstuvwxyz-_=+[]{};:,./<>?" "<>"
102 728 mdecorde
  StrCmp $0 "123456789abcdefghijklmnopqrstuvwxyz!@#%^&*()ABCDEFGHIJKLMNOPQRSTUVWXYZ-_=+[]{};:,./<>?" 0 strcaseerror
103 728 mdecorde
  ${StrCase} $0 "what about taking a shower tomorrow? it's late to do so now! try to sleep now. Good Night!" "S"
104 728 mdecorde
  StrCmp $0 "What about taking a shower tomorrow? It's late to do so now! Try to sleep now. Good night!" 0 strcaseerror
105 728 mdecorde
  !insertmacro StackVerificationEnd
106 728 mdecorde
  IfErrors strcaseerror
107 728 mdecorde
108 728 mdecorde
  DetailPrint "PASSED StrCase test"
109 728 mdecorde
  Goto +2
110 728 mdecorde
strcaseerror:
111 728 mdecorde
  DetailPrint "FAILED StrCase test"
112 728 mdecorde
113 728 mdecorde
  # Test clipboard function
114 728 mdecorde
  !insertmacro StackVerificationStart
115 728 mdecorde
  ${StrClb} $0 "StrFunc clipboard test" ">"
116 728 mdecorde
  StrCmp $0 "" 0 strclberror
117 728 mdecorde
  ${StrClb} $0 "StrFunc clipboard test #2" "<>"
118 728 mdecorde
  StrCmp $0 "StrFunc clipboard test" 0 strclberror
119 728 mdecorde
  ${StrClb} $0 "" "<"
120 728 mdecorde
  StrCmp $0 "StrFunc clipboard test #2" 0 strclberror
121 728 mdecorde
  ${StrClb} $0 "" ""
122 728 mdecorde
  StrCmp $0 "" 0 strclberror
123 728 mdecorde
  !insertmacro StackVerificationEnd
124 728 mdecorde
  IfErrors strclberror
125 728 mdecorde
126 728 mdecorde
  DetailPrint "PASSED StrClb test"
127 728 mdecorde
  Goto +2
128 728 mdecorde
strclberror:
129 728 mdecorde
  DetailPrint "FAILED StrClb test"
130 728 mdecorde
131 728 mdecorde
  # Test IO functions
132 728 mdecorde
  !insertmacro StackVerificationStart
133 728 mdecorde
  !macro testio str
134 728 mdecorde
  ${StrNSISToIO} $0 "${str}"
135 728 mdecorde
  ${StrIOToNSIS} $0 $0
136 728 mdecorde
  StrCmp $0 "${str}" 0 ioerror
137 728 mdecorde
  !macroend
138 728 mdecorde
  !insertmacro testio "$\rtest$\n"
139 728 mdecorde
  !insertmacro testio "test$\n"
140 728 mdecorde
  !insertmacro testio "$\rtest"
141 728 mdecorde
  !insertmacro testio "test"
142 728 mdecorde
  !insertmacro testio "$\r\$\t$\n"
143 728 mdecorde
  !insertmacro testio "$\r \ $\t $\n $$"
144 728 mdecorde
  !insertmacro testio ""
145 728 mdecorde
  !insertmacro testio " "
146 728 mdecorde
  !insertmacro StackVerificationEnd
147 728 mdecorde
  IfErrors ioerror
148 728 mdecorde
149 728 mdecorde
  DetailPrint "PASSED StrNSISToIO/StrIOToNSIS test"
150 728 mdecorde
  Goto +2
151 728 mdecorde
ioerror:
152 728 mdecorde
  DetailPrint "FAILED StrNSISToIO/StrIOToNSIS test"
153 728 mdecorde
154 728 mdecorde
  # Test string search functions
155 728 mdecorde
  !insertmacro StackVerificationStart
156 728 mdecorde
  ${StrLoc} $0 "This is just an example" "just" "<"
157 728 mdecorde
  StrCmp $0 "11" 0 strlocerror
158 728 mdecorde
  ${StrLoc} $0 a abc <
159 728 mdecorde
  StrCmp $0 "" 0 strlocerror
160 728 mdecorde
  ${StrLoc} $0 a abc >
161 728 mdecorde
  StrCmp $0 "" 0 strlocerror
162 728 mdecorde
  ${StrLoc} $0 abc a >
163 728 mdecorde
  StrCmp $0 "0" 0 strlocerror
164 728 mdecorde
  ${StrLoc} $0 abc b >
165 728 mdecorde
  StrCmp $0 "1" 0 strlocerror
166 728 mdecorde
  ${StrLoc} $0 abc c >
167 728 mdecorde
  StrCmp $0 "2" 0 strlocerror
168 728 mdecorde
  ${StrLoc} $0 abc a <
169 728 mdecorde
  StrCmp $0 "2" 0 strlocerror
170 728 mdecorde
  ${StrLoc} $0 abc b <
171 728 mdecorde
  StrCmp $0 "1" 0 strlocerror
172 728 mdecorde
  ${StrLoc} $0 abc c <
173 728 mdecorde
  StrCmp $0 "0" 0 strlocerror
174 728 mdecorde
  ${StrLoc} $0 abc d <
175 728 mdecorde
  StrCmp $0 "" 0 strlocerror
176 728 mdecorde
  !insertmacro StackVerificationEnd
177 728 mdecorde
  IfErrors strlocerror
178 728 mdecorde
179 728 mdecorde
  DetailPrint "PASSED StrLoc test"
180 728 mdecorde
  Goto +2
181 728 mdecorde
strlocerror:
182 728 mdecorde
  DetailPrint "FAILED StrLoc test"
183 728 mdecorde
184 728 mdecorde
  # Test string replacement
185 728 mdecorde
  !insertmacro StackVerificationStart
186 728 mdecorde
  ${StrRep} $0 "This is just an example" "an" "one"
187 728 mdecorde
  StrCmp $0 "This is just one example" 0 strreperror
188 728 mdecorde
  ${StrRep} $0 "test... test... 1 2 3..." "test" "testing"
189 728 mdecorde
  StrCmp $0 "testing... testing... 1 2 3..." 0 strreperror
190 728 mdecorde
  ${StrRep} $0 "" "test" "testing"
191 728 mdecorde
  StrCmp $0 "" 0 strreperror
192 728 mdecorde
  ${StrRep} $0 "test" "test" "testing"
193 728 mdecorde
  StrCmp $0 "testing" 0 strreperror
194 728 mdecorde
  ${StrRep} $0 "test" "test" ""
195 728 mdecorde
  StrCmp $0 "" 0 strreperror
196 728 mdecorde
  ${StrRep} $0 "test" "" "abc"
197 728 mdecorde
  StrCmp $0 "test" 0 strreperror
198 728 mdecorde
  ${StrRep} $0 "test" "" ""
199 728 mdecorde
  StrCmp $0 "test" 0 strreperror
200 728 mdecorde
  !insertmacro StackVerificationEnd
201 728 mdecorde
  IfErrors strreperror
202 728 mdecorde
203 728 mdecorde
  DetailPrint "PASSED StrRep test"
204 728 mdecorde
  Goto +2
205 728 mdecorde
strreperror:
206 728 mdecorde
  DetailPrint "FAILED StrRep test"
207 728 mdecorde
208 728 mdecorde
  # Test sorting
209 728 mdecorde
  !insertmacro StackVerificationStart
210 728 mdecorde
  ${StrSort} $0 "This is just an example" "" " just" "ple" "0" "0" "0"
211 728 mdecorde
  StrCmp $0 "This is an exam" 0 strsorterror
212 728 mdecorde
  ${StrSort} $0 "This is just an example" " " "j" " " "0" "" "0"
213 728 mdecorde
  StrCmp $0 "just" 0 strsorterror
214 728 mdecorde
  ${StrSort} $0 "This is just an example" "" "j" "" "0" "1" "0"
215 728 mdecorde
  StrCmp $0 "This is just an example" 0 strsorterror
216 728 mdecorde
  ${StrSort} $0 "This is just an example" " " "us" "" "0" "1" "0"
217 728 mdecorde
  StrCmp $0 "just an example" 0 strsorterror
218 728 mdecorde
  ${StrSort} $0 "This is just an example" "" "u" " " "0" "1" "0"
219 728 mdecorde
  StrCmp $0 "This is just" 0 strsorterror
220 728 mdecorde
  ${StrSort} $0 "This is just an example" " " "just" " " "0" "1" "0"
221 728 mdecorde
  StrCmp $0 "just" 0 strsorterror
222 728 mdecorde
  ${StrSort} $0 "This is just an example" " " "t" " " "0" "1" "0"
223 728 mdecorde
  StrCmp $0 "This" 0 strsorterror
224 728 mdecorde
  ${StrSort} $0 "This is just an example" " " "le" " " "0" "1" "0"
225 728 mdecorde
  StrCmp $0 "example" 0 strsorterror
226 728 mdecorde
  ${StrSort} $0 "This is just an example" " " "le" " " "1" "0" "0"
227 728 mdecorde
  StrCmp $0 " examp" 0 strsorterror
228 728 mdecorde
  ${StrSort} $0 "an error has occurred" " " "e" " " "0" "1" "0"
229 728 mdecorde
  StrCmp $0 "error" 0 strsorterror
230 728 mdecorde
  ${StrSort} $0 "" " " "something" " " "0" "1" "0"
231 728 mdecorde
  StrCmp $0 "" 0 strsorterror
232 728 mdecorde
  ${StrSort} $0 "This is just an example" " " "j" " " "" "" ""
233 728 mdecorde
  StrCmp $0 " just " 0 strsorterror
234 728 mdecorde
  ${StrSort} $0 "This is just an example" " " "j" " " "1" "0" "1"
235 728 mdecorde
  StrCmp $0 " ust " 0 strsorterror
236 728 mdecorde
  ${StrSort} $0 "This is just an example" "" "j" "" "0" "0" "1"
237 728 mdecorde
  StrCmp $0 "This is ust an example" 0 strsorterror
238 728 mdecorde
  ${StrSort} $0 "This is just an example" " " "us" "" "1" "0" "0"
239 728 mdecorde
  StrCmp $0 " jt an example" 0 strsorterror
240 728 mdecorde
  ${StrSort} $0 "This is just an example" "" "u" " " "0" "0" "1"
241 728 mdecorde
  StrCmp $0 "This is jst " 0 strsorterror
242 728 mdecorde
  ${StrSort} $0 "This is just an example" " " "just" " " "1" "0" "1"
243 728 mdecorde
  StrCmp $0 "  " 0 strsorterror
244 728 mdecorde
  ${StrSort} $0 "an error has occurred" " " "e" "h" "1" "0" "0"
245 728 mdecorde
  StrCmp $0 " rror " 0 strsorterror
246 728 mdecorde
  ${StrSort} $0 "" " " "something" " " "1" "0" "1"
247 728 mdecorde
  StrCmp $0 "" 0 strsorterror
248 728 mdecorde
  !insertmacro StackVerificationEnd
249 728 mdecorde
  IfErrors strsorterror
250 728 mdecorde
251 728 mdecorde
  DetailPrint "PASSED StrSort test"
252 728 mdecorde
  Goto +2
253 728 mdecorde
strsorterror:
254 728 mdecorde
  DetailPrint "FAILED StrSort test"
255 728 mdecorde
256 728 mdecorde
  !insertmacro StackVerificationStart
257 728 mdecorde
  ${StrStr} $0 "abcefghijklmnopqrstuvwxyz" "g"
258 728 mdecorde
  StrCmp $0 "ghijklmnopqrstuvwxyz" 0 strstrerror
259 728 mdecorde
  ${StrStr} $0 "abcefghijklmnopqrstuvwxyz" "ga"
260 728 mdecorde
  StrCmp $0 "" 0 strstrerror
261 728 mdecorde
  ${StrStr} $0 "abcefghijklmnopqrstuvwxyz" ""
262 728 mdecorde
  StrCmp $0 "abcefghijklmnopqrstuvwxyz" 0 strstrerror
263 728 mdecorde
  ${StrStr} $0 "a" "abcefghijklmnopqrstuvwxyz"
264 728 mdecorde
  StrCmp $0 "" 0 strstrerror
265 728 mdecorde
  !insertmacro StackVerificationEnd
266 728 mdecorde
  IfErrors strstrerror
267 728 mdecorde
268 728 mdecorde
  DetailPrint "PASSED StrStr test"
269 728 mdecorde
  Goto +2
270 728 mdecorde
strstrerror:
271 728 mdecorde
  DetailPrint "FAILED StrStr test"
272 728 mdecorde
273 728 mdecorde
  !insertmacro StackVerificationStart
274 728 mdecorde
  ${StrStrAdv} $0 "abcabcabc" "a" ">" ">" "1" "0" "0"
275 728 mdecorde
  StrCmp $0 "abcabcabc" 0 strstradverror
276 728 mdecorde
  ${StrStrAdv} $0 "abcabcabc" "a" ">" ">" "1" "1" "0"
277 728 mdecorde
  StrCmp $0 "abcabc" 0 strstradverror
278 728 mdecorde
  ${StrStrAdv} $0 "abcabcabc" "a" ">" ">" "1" "2" "0"
279 728 mdecorde
  StrCmp $0 "abc" 0 strstradverror
280 728 mdecorde
  ${StrStrAdv} $0 "abcabcabc" "a" ">" ">" "1" "3" "0"
281 728 mdecorde
  StrCmp $0 "" 0 strstradverror
282 728 mdecorde
  ${StrStrAdv} $0 "abcabcabc" "abc" ">" "<" "1" "1" "0"
283 728 mdecorde
  StrCmp $0 "abcabc" 0 strstradverror
284 728 mdecorde
  ${StrStrAdv} $0 "abcabcabc" "abc" ">" "<" "0" "1" "0"
285 728 mdecorde
  StrCmp $0 "abc" 0 strstradverror
286 728 mdecorde
  ${StrStrAdv} $0 "abcabcabc" "abc" "<" "<" "1" "0" "0"
287 728 mdecorde
  StrCmp $0 "abcabcabc" 0 strstradverror
288 728 mdecorde
  ${StrStrAdv} $0 "abcabcabc" "abc" "<" "<" "0" "0" "0"
289 728 mdecorde
  StrCmp $0 "abcabc" 0 strstradverror
290 728 mdecorde
  ${StrStrAdv} $0 "abcabcabc" "abc" "<" ">" "0" "0" "0"
291 728 mdecorde
  StrCmp $0 "" 0 strstradverror
292 728 mdecorde
  ${StrStrAdv} $0 "abcabcabc" "abc" "<" ">" "0" "1" "0"
293 728 mdecorde
  StrCmp $0 "abc" 0 strstradverror
294 728 mdecorde
  ${StrStrAdv} $0 "ABCabcabc" "a" ">" ">" "1" "0" "1"
295 728 mdecorde
  StrCmp $0 "abcabc" 0 strstradverror
296 728 mdecorde
  ${StrStrAdv} $0 "ABCabcabc" "a" ">" ">" "1" "1" "1"
297 728 mdecorde
  StrCmp $0 "abc" 0 strstradverror
298 728 mdecorde
  ${StrStrAdv} $0 "ABCabcabc" "a" ">" ">" "1" "2" "1"
299 728 mdecorde
  StrCmp $0 "" 0 strstradverror
300 728 mdecorde
  ${StrStrAdv} $0 "ABCabcabc" "a" ">" ">" "1" "3" "1"
301 728 mdecorde
  StrCmp $0 "" 0 strstradverror
302 728 mdecorde
  ${StrStrAdv} $0 "ABCabcabc" "abc" ">" "<" "1" "1" "1"
303 728 mdecorde
  StrCmp $0 "ABCabcabc" 0 strstradverror
304 728 mdecorde
  ${StrStrAdv} $0 "ABCabcabc" "abc" ">" "<" "0" "1" "1"
305 728 mdecorde
  StrCmp $0 "ABCabc" 0 strstradverror
306 728 mdecorde
  ${StrStrAdv} $0 "ABCabcabc" "abc" "<" "<" "1" "0" "1"
307 728 mdecorde
  StrCmp $0 "ABCabcabc" 0 strstradverror
308 728 mdecorde
  ${StrStrAdv} $0 "ABCabcabc" "abc" "<" "<" "0" "0" "1"
309 728 mdecorde
  StrCmp $0 "ABCabc" 0 strstradverror
310 728 mdecorde
  ${StrStrAdv} $0 "ABCabcabc" "abc" "<" ">" "0" "0" "1"
311 728 mdecorde
  StrCmp $0 "" 0 strstradverror
312 728 mdecorde
  ${StrStrAdv} $0 "ABCabcabc" "abc" "<" ">" "0" "1" "1"
313 728 mdecorde
  StrCmp $0 "abc" 0 strstradverror
314 728 mdecorde
  !insertmacro StackVerificationEnd
315 728 mdecorde
  IfErrors strstradverror
316 728 mdecorde
317 728 mdecorde
  DetailPrint "PASSED StrStrAdv test"
318 728 mdecorde
  Goto +2
319 728 mdecorde
strstradverror:
320 728 mdecorde
  DetailPrint "FAILED StrStrAdv test"
321 728 mdecorde
322 728 mdecorde
  # Test tokenizer
323 728 mdecorde
  !insertmacro StackVerificationStart
324 728 mdecorde
  ${StrTok} $0 "This is, or is not, just an example" " ," "4" "1"
325 728 mdecorde
  StrCmp $0 "not" 0 strtokerror
326 728 mdecorde
  ${StrTok} $0 "This is, or is not, just an example" " ," "4" "0"
327 728 mdecorde
  StrCmp $0 "is" 0 strtokerror
328 728 mdecorde
  ${StrTok} $0 "This is, or is not, just an example" " ," "152" "0"
329 728 mdecorde
  StrCmp $0 "" 0 strtokerror
330 728 mdecorde
  ${StrTok} $0 "This is, or is not, just an example" " ," "" "0"
331 728 mdecorde
  StrCmp $0 "example" 0 strtokerror
332 728 mdecorde
  ${StrTok} $0 "This is, or is not, just an example" " ," "L" "0"
333 728 mdecorde
  StrCmp $0 "example" 0 strtokerror
334 728 mdecorde
  ${StrTok} $0 "This is, or is not, just an example" " ," "0" "0"
335 728 mdecorde
  StrCmp $0 "This" 0 strtokerror
336 728 mdecorde
  !insertmacro StackVerificationEnd
337 728 mdecorde
  IfErrors strtokerror
338 728 mdecorde
339 728 mdecorde
  DetailPrint "PASSED StrTok test"
340 728 mdecorde
  Goto +2
341 728 mdecorde
strtokerror:
342 728 mdecorde
  DetailPrint "FAILED StrTok test"
343 728 mdecorde
344 728 mdecorde
  # Test trim new lines
345 728 mdecorde
  !insertmacro StackVerificationStart
346 728 mdecorde
  ${StrTrimNewLines} $0 "$\r$\ntest$\r$\ntest$\r$\n"
347 728 mdecorde
  StrCmp $0 "$\r$\ntest$\r$\ntest" 0 strtrimnewlineserror
348 728 mdecorde
  !insertmacro StackVerificationEnd
349 728 mdecorde
  IfErrors strtrimnewlineserror
350 728 mdecorde
351 728 mdecorde
  DetailPrint "PASSED StrTrimNewLines test"
352 728 mdecorde
  Goto +2
353 728 mdecorde
strtrimnewlineserror:
354 728 mdecorde
  DetailPrint "FAILED StrTrimNewLines test"
355 728 mdecorde
356 728 mdecorde
  WriteUninstaller $EXEDIR\UnStrFunc.exe
357 728 mdecorde
358 728 mdecorde
  Exec $EXEDIR\UnStrFunc.exe
359 728 mdecorde
360 728 mdecorde
SectionEnd
361 728 mdecorde
362 728 mdecorde
Section Uninstall
363 728 mdecorde
364 728 mdecorde
  # Test case conversion
365 728 mdecorde
  !insertmacro StackVerificationStart
366 728 mdecorde
  ${UnStrCase} $0 "This is just an example. A very simple one." ""
367 728 mdecorde
  StrCmp $0 "This is just an example. A very simple one." 0 strcaseerror
368 728 mdecorde
  ${UnStrCase} $0 "THIS IS JUST AN EXAMPLE. A VERY SIMPLE ONE." "S"
369 728 mdecorde
  StrCmp $0 "This is just an example. A very simple one." 0 strcaseerror
370 728 mdecorde
  ${UnStrCase} $0 "This is just an example. A very simple one." "L"
371 728 mdecorde
  StrCmp $0 "this is just an example. a very simple one." 0 strcaseerror
372 728 mdecorde
  ${UnStrCase} $0 "This is just an example. A very simple one." "U"
373 728 mdecorde
  StrCmp $0 "THIS IS JUST AN EXAMPLE. A VERY SIMPLE ONE." 0 strcaseerror
374 728 mdecorde
  ${UnStrCase} $0 "This is just an example. A very simple one." "T"
375 728 mdecorde
  StrCmp $0 "This Is Just An Example. A Very Simple One." 0 strcaseerror
376 728 mdecorde
  ${UnStrCase} $0 "This is just an example. A very simple one." "<>"
377 728 mdecorde
  StrCmp $0 "tHIS IS JUST AN EXAMPLE. a VERY SIMPLE ONE." 0 strcaseerror
378 728 mdecorde
  ${UnStrCase} $0 "123456789!@#%^&*()-_=+[]{};:,./<>?" "S"
379 728 mdecorde
  StrCmp $0 "123456789!@#%^&*()-_=+[]{};:,./<>?" 0 strcaseerror
380 728 mdecorde
  ${UnStrCase} $0 "123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ!@#%^&*()abcdefghijklmnopqrstuvwxyz-_=+[]{};:,./<>?" "<>"
381 728 mdecorde
  StrCmp $0 "123456789abcdefghijklmnopqrstuvwxyz!@#%^&*()ABCDEFGHIJKLMNOPQRSTUVWXYZ-_=+[]{};:,./<>?" 0 strcaseerror
382 728 mdecorde
  ${UnStrCase} $0 "what about taking a shower tomorrow? it's late to do so now! try to sleep now. Good Night!" "S"
383 728 mdecorde
  StrCmp $0 "What about taking a shower tomorrow? It's late to do so now! Try to sleep now. Good night!" 0 strcaseerror
384 728 mdecorde
  !insertmacro StackVerificationEnd
385 728 mdecorde
  IfErrors strcaseerror
386 728 mdecorde
387 728 mdecorde
  DetailPrint "PASSED StrCase test"
388 728 mdecorde
  Goto +2
389 728 mdecorde
strcaseerror:
390 728 mdecorde
  DetailPrint "FAILED StrCase test"
391 728 mdecorde
392 728 mdecorde
  # Test clipboard function
393 728 mdecorde
  !insertmacro StackVerificationStart
394 728 mdecorde
  ${UnStrClb} $0 "StrFunc clipboard test" ">"
395 728 mdecorde
  StrCmp $0 "" 0 strclberror
396 728 mdecorde
  ${UnStrClb} $0 "StrFunc clipboard test #2" "<>"
397 728 mdecorde
  StrCmp $0 "StrFunc clipboard test" 0 strclberror
398 728 mdecorde
  ${UnStrClb} $0 "" "<"
399 728 mdecorde
  StrCmp $0 "StrFunc clipboard test #2" 0 strclberror
400 728 mdecorde
  ${UnStrClb} $0 "" ""
401 728 mdecorde
  StrCmp $0 "" 0 strclberror
402 728 mdecorde
  !insertmacro StackVerificationEnd
403 728 mdecorde
  IfErrors strclberror
404 728 mdecorde
405 728 mdecorde
  DetailPrint "PASSED StrClb test"
406 728 mdecorde
  Goto +2
407 728 mdecorde
strclberror:
408 728 mdecorde
  DetailPrint "FAILED StrClb test"
409 728 mdecorde
410 728 mdecorde
  # Test IO functions
411 728 mdecorde
  !insertmacro StackVerificationStart
412 728 mdecorde
  !macro untestio str
413 728 mdecorde
  ${UnStrNSISToIO} $0 "${str}"
414 728 mdecorde
  ${UnStrIOToNSIS} $0 $0
415 728 mdecorde
  StrCmp $0 "${str}" 0 ioerror
416 728 mdecorde
  !macroend
417 728 mdecorde
  !insertmacro untestio "$\rtest$\n"
418 728 mdecorde
  !insertmacro untestio "test$\n"
419 728 mdecorde
  !insertmacro untestio "$\rtest"
420 728 mdecorde
  !insertmacro untestio "test"
421 728 mdecorde
  !insertmacro untestio "$\r\$\t$\n"
422 728 mdecorde
  !insertmacro untestio "$\r \ $\t $\n $$"
423 728 mdecorde
  !insertmacro untestio ""
424 728 mdecorde
  !insertmacro untestio " "
425 728 mdecorde
  !insertmacro StackVerificationEnd
426 728 mdecorde
  IfErrors ioerror
427 728 mdecorde
428 728 mdecorde
  DetailPrint "PASSED StrNSISToIO/StrIOToNSIS test"
429 728 mdecorde
  Goto +2
430 728 mdecorde
ioerror:
431 728 mdecorde
  DetailPrint "FAILED StrNSISToIO/StrIOToNSIS test"
432 728 mdecorde
433 728 mdecorde
  # Test string search functions
434 728 mdecorde
  !insertmacro StackVerificationStart
435 728 mdecorde
  ${UnStrLoc} $0 "This is just an example" "just" "<"
436 728 mdecorde
  StrCmp $0 "11" 0 strlocerror
437 728 mdecorde
  ${UnStrLoc} $0 a abc <
438 728 mdecorde
  StrCmp $0 "" 0 strlocerror
439 728 mdecorde
  ${UnStrLoc} $0 a abc >
440 728 mdecorde
  StrCmp $0 "" 0 strlocerror
441 728 mdecorde
  ${UnStrLoc} $0 abc a >
442 728 mdecorde
  StrCmp $0 "0" 0 strlocerror
443 728 mdecorde
  ${UnStrLoc} $0 abc b >
444 728 mdecorde
  StrCmp $0 "1" 0 strlocerror
445 728 mdecorde
  ${UnStrLoc} $0 abc c >
446 728 mdecorde
  StrCmp $0 "2" 0 strlocerror
447 728 mdecorde
  ${UnStrLoc} $0 abc a <
448 728 mdecorde
  StrCmp $0 "2" 0 strlocerror
449 728 mdecorde
  ${UnStrLoc} $0 abc b <
450 728 mdecorde
  StrCmp $0 "1" 0 strlocerror
451 728 mdecorde
  ${UnStrLoc} $0 abc c <
452 728 mdecorde
  StrCmp $0 "0" 0 strlocerror
453 728 mdecorde
  ${UnStrLoc} $0 abc d <
454 728 mdecorde
  StrCmp $0 "" 0 strlocerror
455 728 mdecorde
  !insertmacro StackVerificationEnd
456 728 mdecorde
  IfErrors strlocerror
457 728 mdecorde
458 728 mdecorde
  DetailPrint "PASSED StrLoc test"
459 728 mdecorde
  Goto +2
460 728 mdecorde
strlocerror:
461 728 mdecorde
  DetailPrint "FAILED StrLoc test"
462 728 mdecorde
463 728 mdecorde
  # Test string replacement
464 728 mdecorde
  !insertmacro StackVerificationStart
465 728 mdecorde
  ${UnStrRep} $0 "This is just an example" "an" "one"
466 728 mdecorde
  StrCmp $0 "This is just one example" 0 strreperror
467 728 mdecorde
  ${UnStrRep} $0 "test... test... 1 2 3..." "test" "testing"
468 728 mdecorde
  StrCmp $0 "testing... testing... 1 2 3..." 0 strreperror
469 728 mdecorde
  ${UnStrRep} $0 "" "test" "testing"
470 728 mdecorde
  StrCmp $0 "" 0 strreperror
471 728 mdecorde
  ${UnStrRep} $0 "test" "test" "testing"
472 728 mdecorde
  StrCmp $0 "testing" 0 strreperror
473 728 mdecorde
  ${UnStrRep} $0 "test" "test" ""
474 728 mdecorde
  StrCmp $0 "" 0 strreperror
475 728 mdecorde
  ${UnStrRep} $0 "test" "" "abc"
476 728 mdecorde
  StrCmp $0 "test" 0 strreperror
477 728 mdecorde
  ${UnStrRep} $0 "test" "" ""
478 728 mdecorde
  StrCmp $0 "test" 0 strreperror
479 728 mdecorde
  !insertmacro StackVerificationEnd
480 728 mdecorde
  IfErrors strreperror
481 728 mdecorde
482 728 mdecorde
  DetailPrint "PASSED StrRep test"
483 728 mdecorde
  Goto +2
484 728 mdecorde
strreperror:
485 728 mdecorde
  DetailPrint "FAILED StrRep test"
486 728 mdecorde
487 728 mdecorde
  # Test sorting
488 728 mdecorde
  !insertmacro StackVerificationStart
489 728 mdecorde
  ${UnStrSort} $0 "This is just an example" "" " just" "ple" "0" "0" "0"
490 728 mdecorde
  StrCmp $0 "This is an exam" 0 strsorterror
491 728 mdecorde
  ${UnStrSort} $0 "This is just an example" " " "j" " " "0" "" "0"
492 728 mdecorde
  StrCmp $0 "just" 0 strsorterror
493 728 mdecorde
  ${UnStrSort} $0 "This is just an example" "" "j" "" "0" "1" "0"
494 728 mdecorde
  StrCmp $0 "This is just an example" 0 strsorterror
495 728 mdecorde
  ${UnStrSort} $0 "This is just an example" " " "us" "" "0" "1" "0"
496 728 mdecorde
  StrCmp $0 "just an example" 0 strsorterror
497 728 mdecorde
  ${UnStrSort} $0 "This is just an example" "" "u" " " "0" "1" "0"
498 728 mdecorde
  StrCmp $0 "This is just" 0 strsorterror
499 728 mdecorde
  ${UnStrSort} $0 "This is just an example" " " "just" " " "0" "1" "0"
500 728 mdecorde
  StrCmp $0 "just" 0 strsorterror
501 728 mdecorde
  ${UnStrSort} $0 "This is just an example" " " "t" " " "0" "1" "0"
502 728 mdecorde
  StrCmp $0 "This" 0 strsorterror
503 728 mdecorde
  ${UnStrSort} $0 "This is just an example" " " "le" " " "0" "1" "0"
504 728 mdecorde
  StrCmp $0 "example" 0 strsorterror
505 728 mdecorde
  ${UnStrSort} $0 "This is just an example" " " "le" " " "1" "0" "0"
506 728 mdecorde
  StrCmp $0 " examp" 0 strsorterror
507 728 mdecorde
  ${UnStrSort} $0 "an error has occurred" " " "e" " " "0" "1" "0"
508 728 mdecorde
  StrCmp $0 "error" 0 strsorterror
509 728 mdecorde
  ${UnStrSort} $0 "" " " "something" " " "0" "1" "0"
510 728 mdecorde
  StrCmp $0 "" 0 strsorterror
511 728 mdecorde
  ${UnStrSort} $0 "This is just an example" " " "j" " " "" "" ""
512 728 mdecorde
  StrCmp $0 " just " 0 strsorterror
513 728 mdecorde
  ${UnStrSort} $0 "This is just an example" " " "j" " " "1" "0" "1"
514 728 mdecorde
  StrCmp $0 " ust " 0 strsorterror
515 728 mdecorde
  ${UnStrSort} $0 "This is just an example" "" "j" "" "0" "0" "1"
516 728 mdecorde
  StrCmp $0 "This is ust an example" 0 strsorterror
517 728 mdecorde
  ${UnStrSort} $0 "This is just an example" " " "us" "" "1" "0" "0"
518 728 mdecorde
  StrCmp $0 " jt an example" 0 strsorterror
519 728 mdecorde
  ${UnStrSort} $0 "This is just an example" "" "u" " " "0" "0" "1"
520 728 mdecorde
  StrCmp $0 "This is jst " 0 strsorterror
521 728 mdecorde
  ${UnStrSort} $0 "This is just an example" " " "just" " " "1" "0" "1"
522 728 mdecorde
  StrCmp $0 "  " 0 strsorterror
523 728 mdecorde
  ${UnStrSort} $0 "an error has occurred" " " "e" "h" "1" "0" "0"
524 728 mdecorde
  StrCmp $0 " rror " 0 strsorterror
525 728 mdecorde
  ${UnStrSort} $0 "" " " "something" " " "1" "0" "1"
526 728 mdecorde
  StrCmp $0 "" 0 strsorterror
527 728 mdecorde
  !insertmacro StackVerificationEnd
528 728 mdecorde
  IfErrors strsorterror
529 728 mdecorde
530 728 mdecorde
  DetailPrint "PASSED StrSort test"
531 728 mdecorde
  Goto +2
532 728 mdecorde
strsorterror:
533 728 mdecorde
  DetailPrint "FAILED StrSort test"
534 728 mdecorde
535 728 mdecorde
  !insertmacro StackVerificationStart
536 728 mdecorde
  ${UnStrStr} $0 "abcefghijklmnopqrstuvwxyz" "g"
537 728 mdecorde
  StrCmp $0 "ghijklmnopqrstuvwxyz" 0 strstrerror
538 728 mdecorde
  ${UnStrStr} $0 "abcefghijklmnopqrstuvwxyz" "ga"
539 728 mdecorde
  StrCmp $0 "" 0 strstrerror
540 728 mdecorde
  ${UnStrStr} $0 "abcefghijklmnopqrstuvwxyz" ""
541 728 mdecorde
  StrCmp $0 "abcefghijklmnopqrstuvwxyz" 0 strstrerror
542 728 mdecorde
  ${UnStrStr} $0 "a" "abcefghijklmnopqrstuvwxyz"
543 728 mdecorde
  StrCmp $0 "" 0 strstrerror
544 728 mdecorde
  !insertmacro StackVerificationEnd
545 728 mdecorde
  IfErrors strstrerror
546 728 mdecorde
547 728 mdecorde
  DetailPrint "PASSED StrStr test"
548 728 mdecorde
  Goto +2
549 728 mdecorde
strstrerror:
550 728 mdecorde
  DetailPrint "FAILED StrStr test"
551 728 mdecorde
552 728 mdecorde
  !insertmacro StackVerificationStart
553 728 mdecorde
  ${UnStrStrAdv} $0 "abcabcabc" "a" ">" ">" "1" "0" "0"
554 728 mdecorde
  StrCmp $0 "abcabcabc" 0 strstradverror
555 728 mdecorde
  ${UnStrStrAdv} $0 "abcabcabc" "a" ">" ">" "1" "1" "0"
556 728 mdecorde
  StrCmp $0 "abcabc" 0 strstradverror
557 728 mdecorde
  ${UnStrStrAdv} $0 "abcabcabc" "a" ">" ">" "1" "2" "0"
558 728 mdecorde
  StrCmp $0 "abc" 0 strstradverror
559 728 mdecorde
  ${UnStrStrAdv} $0 "abcabcabc" "a" ">" ">" "1" "3" "0"
560 728 mdecorde
  StrCmp $0 "" 0 strstradverror
561 728 mdecorde
  ${UnStrStrAdv} $0 "abcabcabc" "abc" ">" "<" "1" "1" "0"
562 728 mdecorde
  StrCmp $0 "abcabc" 0 strstradverror
563 728 mdecorde
  ${UnStrStrAdv} $0 "abcabcabc" "abc" ">" "<" "0" "1" "0"
564 728 mdecorde
  StrCmp $0 "abc" 0 strstradverror
565 728 mdecorde
  ${UnStrStrAdv} $0 "abcabcabc" "abc" "<" "<" "1" "0" "0"
566 728 mdecorde
  StrCmp $0 "abcabcabc" 0 strstradverror
567 728 mdecorde
  ${UnStrStrAdv} $0 "abcabcabc" "abc" "<" "<" "0" "0" "0"
568 728 mdecorde
  StrCmp $0 "abcabc" 0 strstradverror
569 728 mdecorde
  ${UnStrStrAdv} $0 "abcabcabc" "abc" "<" ">" "0" "0" "0"
570 728 mdecorde
  StrCmp $0 "" 0 strstradverror
571 728 mdecorde
  ${UnStrStrAdv} $0 "abcabcabc" "abc" "<" ">" "0" "1" "0"
572 728 mdecorde
  StrCmp $0 "abc" 0 strstradverror
573 728 mdecorde
  ${UnStrStrAdv} $0 "ABCabcabc" "a" ">" ">" "1" "0" "1"
574 728 mdecorde
  StrCmp $0 "abcabc" 0 strstradverror
575 728 mdecorde
  ${UnStrStrAdv} $0 "ABCabcabc" "a" ">" ">" "1" "1" "1"
576 728 mdecorde
  StrCmp $0 "abc" 0 strstradverror
577 728 mdecorde
  ${UnStrStrAdv} $0 "ABCabcabc" "a" ">" ">" "1" "2" "1"
578 728 mdecorde
  StrCmp $0 "" 0 strstradverror
579 728 mdecorde
  ${UnStrStrAdv} $0 "ABCabcabc" "a" ">" ">" "1" "3" "1"
580 728 mdecorde
  StrCmp $0 "" 0 strstradverror
581 728 mdecorde
  ${UnStrStrAdv} $0 "ABCabcabc" "abc" ">" "<" "1" "1" "1"
582 728 mdecorde
  StrCmp $0 "ABCabcabc" 0 strstradverror
583 728 mdecorde
  ${UnStrStrAdv} $0 "ABCabcabc" "abc" ">" "<" "0" "1" "1"
584 728 mdecorde
  StrCmp $0 "ABCabc" 0 strstradverror
585 728 mdecorde
  ${UnStrStrAdv} $0 "ABCabcabc" "abc" "<" "<" "1" "0" "1"
586 728 mdecorde
  StrCmp $0 "ABCabcabc" 0 strstradverror
587 728 mdecorde
  ${UnStrStrAdv} $0 "ABCabcabc" "abc" "<" "<" "0" "0" "1"
588 728 mdecorde
  StrCmp $0 "ABCabc" 0 strstradverror
589 728 mdecorde
  ${UnStrStrAdv} $0 "ABCabcabc" "abc" "<" ">" "0" "0" "1"
590 728 mdecorde
  StrCmp $0 "" 0 strstradverror
591 728 mdecorde
  ${UnStrStrAdv} $0 "ABCabcabc" "abc" "<" ">" "0" "1" "1"
592 728 mdecorde
  StrCmp $0 "abc" 0 strstradverror
593 728 mdecorde
  !insertmacro StackVerificationEnd
594 728 mdecorde
  IfErrors strstradverror
595 728 mdecorde
596 728 mdecorde
  DetailPrint "PASSED StrStrAdv test"
597 728 mdecorde
  Goto +2
598 728 mdecorde
strstradverror:
599 728 mdecorde
  DetailPrint "FAILED StrStrAdv test"
600 728 mdecorde
601 728 mdecorde
  # Test tokenizer
602 728 mdecorde
  !insertmacro StackVerificationStart
603 728 mdecorde
  ${UnStrTok} $0 "This is, or is not, just an example" " ," "4" "1"
604 728 mdecorde
  StrCmp $0 "not" 0 strtokerror
605 728 mdecorde
  ${UnStrTok} $0 "This is, or is not, just an example" " ," "4" "0"
606 728 mdecorde
  StrCmp $0 "is" 0 strtokerror
607 728 mdecorde
  ${UnStrTok} $0 "This is, or is not, just an example" " ," "152" "0"
608 728 mdecorde
  StrCmp $0 "" 0 strtokerror
609 728 mdecorde
  ${UnStrTok} $0 "This is, or is not, just an example" " ," "" "0"
610 728 mdecorde
  StrCmp $0 "example" 0 strtokerror
611 728 mdecorde
  ${UnStrTok} $0 "This is, or is not, just an example" " ," "L" "0"
612 728 mdecorde
  StrCmp $0 "example" 0 strtokerror
613 728 mdecorde
  ${UnStrTok} $0 "This is, or is not, just an example" " ," "0" "0"
614 728 mdecorde
  StrCmp $0 "This" 0 strtokerror
615 728 mdecorde
  !insertmacro StackVerificationEnd
616 728 mdecorde
  IfErrors strtokerror
617 728 mdecorde
618 728 mdecorde
  DetailPrint "PASSED StrTok test"
619 728 mdecorde
  Goto +2
620 728 mdecorde
strtokerror:
621 728 mdecorde
  DetailPrint "FAILED StrTok test"
622 728 mdecorde
623 728 mdecorde
  # Test trim new lines
624 728 mdecorde
  !insertmacro StackVerificationStart
625 728 mdecorde
  ${UnStrTrimNewLines} $0 "$\r$\ntest$\r$\ntest$\r$\n"
626 728 mdecorde
  StrCmp $0 "$\r$\ntest$\r$\ntest" 0 strtrimnewlineserror
627 728 mdecorde
  !insertmacro StackVerificationEnd
628 728 mdecorde
  IfErrors strtrimnewlineserror
629 728 mdecorde
630 728 mdecorde
  DetailPrint "PASSED StrTrimNewLines test"
631 728 mdecorde
  Goto +2
632 728 mdecorde
strtrimnewlineserror:
633 728 mdecorde
  DetailPrint "FAILED StrTrimNewLines test"
634 728 mdecorde
635 728 mdecorde
SectionEnd