Statistiques
| Révision :

root / tmp / org.txm.setups / nsis / Include / StrFunc.nsh @ 1610

Historique | Voir | Annoter | Télécharger (46,95 ko)

1 728 mdecorde
/*
2 728 mdecorde
o-----------------------------------------------------------------------------o
3 728 mdecorde
|String Functions Header File 1.09                                            |
4 728 mdecorde
(-----------------------------------------------------------------------------)
5 728 mdecorde
| By deguix                                     / A Header file for NSIS 2.01 |
6 728 mdecorde
| <cevo_deguix@yahoo.com.br>                   -------------------------------|
7 728 mdecorde
|                                                                             |
8 728 mdecorde
|    This header file contains NSIS functions for string manipulation.        |
9 728 mdecorde
o-----------------------------------------------------------------------------o
10 728 mdecorde
*/
11 728 mdecorde
12 728 mdecorde
!verbose push
13 728 mdecorde
!verbose 3
14 728 mdecorde
!ifndef STRFUNC_VERBOSITY
15 728 mdecorde
  !define STRFUNC_VERBOSITY 3
16 728 mdecorde
!endif
17 728 mdecorde
!define _STRFUNC_VERBOSITY ${STRFUNC_VERBOSITY}
18 728 mdecorde
!undef STRFUNC_VERBOSITY
19 728 mdecorde
!verbose ${_STRFUNC_VERBOSITY}
20 728 mdecorde
21 728 mdecorde
!include LogicLib.nsh
22 728 mdecorde
23 728 mdecorde
!ifndef STRFUNC
24 728 mdecorde
25 728 mdecorde
  !define FALSE 0
26 728 mdecorde
  !define TRUE 1
27 728 mdecorde
28 728 mdecorde
  ;Header File Identification
29 728 mdecorde
30 728 mdecorde
  !define STRFUNC `String Functions Header File`
31 728 mdecorde
  !define STRFUNC_SHORT `StrFunc`
32 728 mdecorde
  !define STRFUNC_CREDITS `2004 Diego Pedroso`
33 728 mdecorde
34 728 mdecorde
  ;Header File Version
35 728 mdecorde
36 728 mdecorde
  !define STRFUNC_VERMAJ 1
37 728 mdecorde
  !define STRFUNC_VERMED 09
38 728 mdecorde
 ;!define STRFUNC_VERMIN 0
39 728 mdecorde
 ;!define STRFUNC_VERBLD 0
40 728 mdecorde
41 728 mdecorde
  !define STRFUNC_VER `${STRFUNC_VERMAJ}.${STRFUNC_VERMED}`
42 728 mdecorde
43 728 mdecorde
  ;Header File Init Message Prefix and Postfix
44 728 mdecorde
45 728 mdecorde
  !define STRFUNC_INITMSGPRE `----------------------------------------------------------------------$\r$\n`
46 728 mdecorde
  !define STRFUNC_INITMSGPOST `$\r$\n----------------------------------------------------------------------$\r$\n`
47 728 mdecorde
48 728 mdecorde
  ;Header File Init Message
49 728 mdecorde
50 728 mdecorde
  !verbose push
51 728 mdecorde
  !verbose 4
52 728 mdecorde
  !echo `${STRFUNC_INITMSGPRE}NSIS ${STRFUNC} ${STRFUNC_VER} - Copyright ${STRFUNC_CREDITS}${STRFUNC_INITMSGPOST}`
53 728 mdecorde
  !verbose pop
54 728 mdecorde
55 728 mdecorde
  ;Header File Function Init Message Prefix and Postfix
56 728 mdecorde
57 728 mdecorde
  !define STRFUNC_FUNCMSGPRE ``
58 728 mdecorde
  !define STRFUNC_FUNCMSGPOST ``
59 728 mdecorde
60 728 mdecorde
  ;Header File Function Macros
61 728 mdecorde
62 728 mdecorde
  !macro STRFUNC_FUNCLIST_INSERT Name
63 728 mdecorde
    !ifdef StrFunc_List
64 728 mdecorde
      !define StrFunc_List2 `${StrFunc_List}`
65 728 mdecorde
      !undef StrFunc_List
66 728 mdecorde
      !define StrFunc_List `${StrFunc_List2}|${Name}`
67 728 mdecorde
      !undef StrFunc_List2
68 728 mdecorde
    !else
69 728 mdecorde
      !define StrFunc_List `${Name}`
70 728 mdecorde
    !endif
71 728 mdecorde
  !macroend
72 728 mdecorde
73 728 mdecorde
  !macro STRFUNC_DEFFUNC Name
74 728 mdecorde
    !insertmacro STRFUNC_FUNCLIST_INSERT ${Name}
75 728 mdecorde
76 728 mdecorde
    !define `${Name}` `!insertmacro FUNCTION_STRING_${Name}`
77 728 mdecorde
    !define `Un${Name}` `!insertmacro FUNCTION_STRING_Un${Name}`
78 728 mdecorde
  !macroend
79 728 mdecorde
80 728 mdecorde
  !macro STRFUNC_FUNC ShortName Credits
81 728 mdecorde
    !verbose push
82 728 mdecorde
    !verbose 4
83 728 mdecorde
84 728 mdecorde
    !ifndef `Un${ShortName}`
85 728 mdecorde
      !echo `${STRFUNC_FUNCMSGPRE}$ {Un${ShortName}} - Copyright ${Credits}${STRFUNC_FUNCMSGPOST}`
86 728 mdecorde
      !verbose pop
87 728 mdecorde
      !define `Un${ShortName}` `!insertmacro FUNCTION_STRING_Un${ShortName}_Call`
88 728 mdecorde
      !define `Un${ShortName}_INCLUDED`
89 728 mdecorde
      Function `un.${ShortName}`
90 728 mdecorde
    !else
91 728 mdecorde
      !echo `${STRFUNC_FUNCMSGPRE}$ {${ShortName}} - Copyright ${Credits}${STRFUNC_FUNCMSGPOST}`
92 728 mdecorde
      !verbose pop
93 728 mdecorde
      !undef `${ShortName}`
94 728 mdecorde
      !define `${ShortName}` `!insertmacro FUNCTION_STRING_${ShortName}_Call`
95 728 mdecorde
      !define `${ShortName}_INCLUDED`
96 728 mdecorde
      Function `${ShortName}`
97 728 mdecorde
    !endif
98 728 mdecorde
  !macroend
99 728 mdecorde
100 728 mdecorde
  ;Function Names Startup Definition
101 728 mdecorde
102 728 mdecorde
  !insertmacro STRFUNC_DEFFUNC StrCase
103 728 mdecorde
  !define StrCase_List `ResultVar|String|Type`
104 728 mdecorde
  !define StrCase_TypeList `Output|Text|Option  U L T S <>`
105 728 mdecorde
  !macro `FUNCTION_STRING_UnStrCase`
106 728 mdecorde
    !undef UnStrCase
107 728 mdecorde
    !insertmacro FUNCTION_STRING_StrCase
108 728 mdecorde
  !macroend
109 728 mdecorde
110 728 mdecorde
  !insertmacro STRFUNC_DEFFUNC StrClb
111 728 mdecorde
  !define StrClb_List `ResultVar|String|Action`
112 728 mdecorde
  !define StrClb_TypeList `Output|Text|Option  > < <>`
113 728 mdecorde
  !macro `FUNCTION_STRING_UnStrClb`
114 728 mdecorde
    !undef UnStrClb
115 728 mdecorde
    !insertmacro FUNCTION_STRING_StrClb
116 728 mdecorde
  !macroend
117 728 mdecorde
118 728 mdecorde
  !insertmacro STRFUNC_DEFFUNC StrIOToNSIS
119 728 mdecorde
  !define StrIOToNSIS_List `ResultVar|String`
120 728 mdecorde
  !define StrIOToNSIS_TypeList `Output|Text`
121 728 mdecorde
  !macro `FUNCTION_STRING_UnStrIOToNSIS`
122 728 mdecorde
    !undef UnStrIOToNSIS
123 728 mdecorde
    !insertmacro FUNCTION_STRING_StrIOToNSIS
124 728 mdecorde
  !macroend
125 728 mdecorde
126 728 mdecorde
  !insertmacro STRFUNC_DEFFUNC StrLoc
127 728 mdecorde
  !define StrLoc_List `ResultVar|String|StrToSearchFor|CounterDirection`
128 728 mdecorde
  !define StrLoc_TypeList `Output|Text|Text|Option > <`
129 728 mdecorde
  !macro `FUNCTION_STRING_UnStrLoc`
130 728 mdecorde
    !undef UnStrLoc
131 728 mdecorde
    !insertmacro FUNCTION_STRING_StrLoc
132 728 mdecorde
  !macroend
133 728 mdecorde
134 728 mdecorde
  !insertmacro STRFUNC_DEFFUNC StrNSISToIO
135 728 mdecorde
  !define StrNSISToIO_List `ResultVar|String`
136 728 mdecorde
  !define StrNSISToIO_TypeList `Output|Text`
137 728 mdecorde
  !macro `FUNCTION_STRING_UnStrNSISToIO`
138 728 mdecorde
    !undef UnStrNSISToIO
139 728 mdecorde
    !insertmacro FUNCTION_STRING_StrNSISToIO
140 728 mdecorde
  !macroend
141 728 mdecorde
142 728 mdecorde
  !insertmacro STRFUNC_DEFFUNC StrRep
143 728 mdecorde
  !define StrRep_List `ResultVar|String|StrToReplace|ReplacementString`
144 728 mdecorde
  !define StrRep_TypeList `Output|Text|Text|Text`
145 728 mdecorde
  !macro `FUNCTION_STRING_UnStrRep`
146 728 mdecorde
    !undef UnStrRep
147 728 mdecorde
    !insertmacro FUNCTION_STRING_StrRep
148 728 mdecorde
  !macroend
149 728 mdecorde
150 728 mdecorde
  !insertmacro STRFUNC_DEFFUNC StrSort
151 728 mdecorde
  !define StrSort_List `ResultVar|String|LeftStr|CenterStr|RightStr|IncludeLeftStr|IncludeCenterStr|IncludeRightStr`
152 728 mdecorde
  !define StrSort_TypeList `Output|Text|Text|Text|Text|Option 1 0|Option 1 0|Option 1 0`
153 728 mdecorde
  !macro `FUNCTION_STRING_UnStrSort`
154 728 mdecorde
    !undef UnStrSort
155 728 mdecorde
    !insertmacro FUNCTION_STRING_StrSort
156 728 mdecorde
  !macroend
157 728 mdecorde
158 728 mdecorde
  !insertmacro STRFUNC_DEFFUNC StrStr
159 728 mdecorde
  !define StrStr_List `ResultVar|String|StrToSearchFor`
160 728 mdecorde
  !define StrStr_TypeList `Output|Text|Text`
161 728 mdecorde
  !macro `FUNCTION_STRING_UnStrStr`
162 728 mdecorde
    !undef UnStrStr
163 728 mdecorde
    !insertmacro FUNCTION_STRING_StrStr
164 728 mdecorde
  !macroend
165 728 mdecorde
166 728 mdecorde
  !insertmacro STRFUNC_DEFFUNC StrStrAdv
167 728 mdecorde
  !define StrStrAdv_List `ResultVar|String|StrToSearchFor|SearchDirection|ResultStrDirection|DisplayStrToSearch|Loops|CaseSensitive`
168 728 mdecorde
  !define StrStrAdv_TypeList `Output|Text|Text|Option > <|Option > <|Option 1 0|Text|Option 0 1`
169 728 mdecorde
  !macro `FUNCTION_STRING_UnStrStrAdv`
170 728 mdecorde
    !undef UnStrStrAdv
171 728 mdecorde
    !insertmacro FUNCTION_STRING_StrStrAdv
172 728 mdecorde
  !macroend
173 728 mdecorde
174 728 mdecorde
  !insertmacro STRFUNC_DEFFUNC StrTok
175 728 mdecorde
  !define StrTok_List `ResultVar|String|Separators|ResultPart|SkipEmptyParts`
176 728 mdecorde
  !define StrTok_TypeList `Output|Text|Text|Mixed L|Option 1 0`
177 728 mdecorde
  !macro `FUNCTION_STRING_UnStrTok`
178 728 mdecorde
    !undef UnStrTok
179 728 mdecorde
    !insertmacro FUNCTION_STRING_StrTok
180 728 mdecorde
  !macroend
181 728 mdecorde
182 728 mdecorde
  !insertmacro STRFUNC_DEFFUNC StrTrimNewLines
183 728 mdecorde
  !define StrTrimNewLines_List `ResultVar|String`
184 728 mdecorde
  !define StrTrimNewLines_TypeList `Output|Text`
185 728 mdecorde
  !macro `FUNCTION_STRING_UnStrTrimNewLines`
186 728 mdecorde
    !undef UnStrTrimNewLines
187 728 mdecorde
    !insertmacro FUNCTION_STRING_StrTrimNewLines
188 728 mdecorde
  !macroend
189 728 mdecorde
190 728 mdecorde
  ;Function Codes for Install and Uninstall
191 728 mdecorde
192 728 mdecorde
  # Function StrCase
193 728 mdecorde
  ################
194 728 mdecorde
195 728 mdecorde
  !macro FUNCTION_STRING_StrCase
196 728 mdecorde
    !insertmacro STRFUNC_FUNC `StrCase` `2004 Diego Pedroso - Based on functions by Dave Laundon`
197 728 mdecorde
198 728 mdecorde
    /*After this point:
199 728 mdecorde
      ------------------------------------------
200 728 mdecorde
       $0 = String (input)
201 728 mdecorde
       $1 = Type (input)
202 728 mdecorde
       $2 = StrLength (temp)
203 728 mdecorde
       $3 = StartChar (temp)
204 728 mdecorde
       $4 = EndChar (temp)
205 728 mdecorde
       $5 = ResultStr (temp)
206 728 mdecorde
       $6 = CurrentChar (temp)
207 728 mdecorde
       $7 = LastChar (temp)
208 728 mdecorde
       $8 = Temp (temp)*/
209 728 mdecorde
210 728 mdecorde
      ;Get input from user
211 728 mdecorde
      Exch $1
212 728 mdecorde
      Exch
213 728 mdecorde
      Exch $0
214 728 mdecorde
      Exch
215 728 mdecorde
      Push $2
216 728 mdecorde
      Push $3
217 728 mdecorde
      Push $4
218 728 mdecorde
      Push $5
219 728 mdecorde
      Push $6
220 728 mdecorde
      Push $7
221 728 mdecorde
      Push $8
222 728 mdecorde
223 728 mdecorde
      ;Initialize variables
224 728 mdecorde
      StrCpy $2 ""
225 728 mdecorde
      StrCpy $3 ""
226 728 mdecorde
      StrCpy $4 ""
227 728 mdecorde
      StrCpy $5 ""
228 728 mdecorde
      StrCpy $6 ""
229 728 mdecorde
      StrCpy $7 ""
230 728 mdecorde
      StrCpy $8 ""
231 728 mdecorde
232 728 mdecorde
      ;Upper and lower cases are simple to use
233 728 mdecorde
      ${If} $1 == "U"
234 728 mdecorde
235 728 mdecorde
        ;Upper Case System:
236 728 mdecorde
        ;------------------
237 728 mdecorde
        ; Convert all characters to upper case.
238 728 mdecorde
239 728 mdecorde
        System::Call "User32::CharUpper(t r0 r5)i"
240 728 mdecorde
        Goto StrCase_End
241 728 mdecorde
      ${ElseIf} $1 == "L"
242 728 mdecorde
243 728 mdecorde
        ;Lower Case System:
244 728 mdecorde
        ;------------------
245 728 mdecorde
        ; Convert all characters to lower case.
246 728 mdecorde
247 728 mdecorde
        System::Call "User32::CharLower(t r0 r5)i"
248 728 mdecorde
        Goto StrCase_End
249 728 mdecorde
      ${EndIf}
250 728 mdecorde
251 728 mdecorde
      ;For the rest of cases:
252 728 mdecorde
      ;Get "String" length
253 728 mdecorde
      StrLen $2 $0
254 728 mdecorde
255 728 mdecorde
      ;Make a loop until the end of "String"
256 728 mdecorde
      ${For} $3 0 $2
257 728 mdecorde
        ;Add 1 to "EndChar" counter also
258 728 mdecorde
        IntOp $4 $3 + 1
259 728 mdecorde
260 728 mdecorde
        # Step 1: Detect one character at a time
261 728 mdecorde
262 728 mdecorde
        ;Remove characters before "StartChar" except when
263 728 mdecorde
        ;"StartChar" is the first character of "String"
264 728 mdecorde
        ${If} $3 <> 0
265 728 mdecorde
          StrCpy $6 $0 `` $3
266 728 mdecorde
        ${EndIf}
267 728 mdecorde
268 728 mdecorde
        ;Remove characters after "EndChar" except when
269 728 mdecorde
        ;"EndChar" is the last character of "String"
270 728 mdecorde
        ${If} $4 <> $2
271 728 mdecorde
          ${If} $3 = 0
272 728 mdecorde
            StrCpy $6 $0 1
273 728 mdecorde
          ${Else}
274 728 mdecorde
            StrCpy $6 $6 1
275 728 mdecorde
          ${EndIf}
276 728 mdecorde
        ${EndIf}
277 728 mdecorde
278 728 mdecorde
        # Step 2: Convert to the advanced case user chose:
279 728 mdecorde
280 728 mdecorde
        ${If} $1 == "T"
281 728 mdecorde
282 728 mdecorde
          ;Title Case System:
283 728 mdecorde
          ;------------------
284 728 mdecorde
          ; Convert all characters after a non-alphabetic character to upper case.
285 728 mdecorde
          ; Else convert to lower case.
286 728 mdecorde
287 728 mdecorde
          ;Use "IsCharAlpha" for the job
288 728 mdecorde
          System::Call "*(&t1 r7) i .r8"
289 728 mdecorde
          System::Call "*$8(&i1 .r7)"
290 728 mdecorde
          System::Free $8
291 728 mdecorde
          System::Call "user32::IsCharAlpha(i r7) i .r8"
292 728 mdecorde
293 728 mdecorde
          ;Verify "IsCharAlpha" result and convert the character
294 728 mdecorde
          ${If} $8 = 0
295 728 mdecorde
            System::Call "User32::CharUpper(t r6 r6)i"
296 728 mdecorde
          ${Else}
297 728 mdecorde
            System::Call "User32::CharLower(t r6 r6)i"
298 728 mdecorde
          ${EndIf}
299 728 mdecorde
        ${ElseIf} $1 == "S"
300 728 mdecorde
301 728 mdecorde
          ;Sentence Case System:
302 728 mdecorde
          ;------------------
303 728 mdecorde
          ; Convert all characters after a ".", "!" or "?" character to upper case.
304 728 mdecorde
          ; Else convert to lower case. Spaces or tabs after these marks are ignored.
305 728 mdecorde
306 728 mdecorde
          ;Detect current characters and ignore if necessary
307 728 mdecorde
          ${If} $6 == " "
308 728 mdecorde
          ${OrIf} $6 == "$\t"
309 728 mdecorde
            Goto IgnoreLetter
310 728 mdecorde
          ${EndIf}
311 728 mdecorde
312 728 mdecorde
          ;Detect last characters and convert
313 728 mdecorde
          ${If} $7 == "."
314 728 mdecorde
          ${OrIf} $7 == "!"
315 728 mdecorde
          ${OrIf} $7 == "?"
316 728 mdecorde
          ${OrIf} $7 == ""
317 728 mdecorde
            System::Call "User32::CharUpper(t r6 r6)i"
318 728 mdecorde
          ${Else}
319 728 mdecorde
            System::Call "User32::CharLower(t r6 r6)i"
320 728 mdecorde
          ${EndIf}
321 728 mdecorde
        ${ElseIf} $1 == "<>"
322 728 mdecorde
323 728 mdecorde
          ;Switch Case System:
324 728 mdecorde
          ;------------------
325 728 mdecorde
          ; Switch all characters cases to their inverse case.
326 728 mdecorde
327 728 mdecorde
          ;Use "IsCharUpper" for the job
328 728 mdecorde
          System::Call "*(&t1 r6) i .r8"
329 728 mdecorde
          System::Call "*$8(&i1 .r7)"
330 728 mdecorde
          System::Free $8
331 728 mdecorde
          System::Call "user32::IsCharUpper(i r7) i .r8"
332 728 mdecorde
333 728 mdecorde
          ;Verify "IsCharUpper" result and convert the character
334 728 mdecorde
          ${If} $8 = 0
335 728 mdecorde
            System::Call "User32::CharUpper(t r6 r6)i"
336 728 mdecorde
          ${Else}
337 728 mdecorde
            System::Call "User32::CharLower(t r6 r6)i"
338 728 mdecorde
          ${EndIf}
339 728 mdecorde
        ${EndIf}
340 728 mdecorde
341 728 mdecorde
        ;Write the character to "LastChar"
342 728 mdecorde
        StrCpy $7 $6
343 728 mdecorde
344 728 mdecorde
        IgnoreLetter:
345 728 mdecorde
        ;Add this character to "ResultStr"
346 728 mdecorde
        StrCpy $5 `$5$6`
347 728 mdecorde
      ${Next}
348 728 mdecorde
349 728 mdecorde
      StrCase_End:
350 728 mdecorde
351 728 mdecorde
    /*After this point:
352 728 mdecorde
      ------------------------------------------
353 728 mdecorde
       $0 = OutVar (output)*/
354 728 mdecorde
355 728 mdecorde
      ; Copy "ResultStr" to "OutVar"
356 728 mdecorde
      StrCpy $0 $5
357 728 mdecorde
358 728 mdecorde
      ;Return output to user
359 728 mdecorde
      Pop $8
360 728 mdecorde
      Pop $7
361 728 mdecorde
      Pop $6
362 728 mdecorde
      Pop $5
363 728 mdecorde
      Pop $4
364 728 mdecorde
      Pop $3
365 728 mdecorde
      Pop $2
366 728 mdecorde
      Pop $1
367 728 mdecorde
      Exch $0
368 728 mdecorde
    FunctionEnd
369 728 mdecorde
370 728 mdecorde
  !macroend
371 728 mdecorde
372 728 mdecorde
  !macro FUNCTION_STRING_StrClb
373 728 mdecorde
    !insertmacro STRFUNC_FUNC `StrClb` `2004 Diego Pedroso - Based on functions by Nik Medved`
374 728 mdecorde
375 728 mdecorde
    /*After this point:
376 728 mdecorde
      ------------------------------------------
377 728 mdecorde
       $0 = String (input)
378 728 mdecorde
       $1 = Action (input)
379 728 mdecorde
       $2 = Lock/Unlock (temp)
380 728 mdecorde
       $3 = Temp (temp)
381 728 mdecorde
       $4 = Temp2 (temp)*/
382 728 mdecorde
383 728 mdecorde
      ;Get input from user
384 728 mdecorde
385 728 mdecorde
      Exch $1
386 728 mdecorde
      Exch
387 728 mdecorde
      Exch $0
388 728 mdecorde
      Exch
389 728 mdecorde
      Push $2
390 728 mdecorde
      Push $3
391 728 mdecorde
      Push $4
392 728 mdecorde
393 728 mdecorde
      StrCpy $2 ""
394 728 mdecorde
      StrCpy $3 ""
395 728 mdecorde
      StrCpy $4 ""
396 728 mdecorde
397 728 mdecorde
      ;Open the clipboard to do the operations the user chose (kichik's fix)
398 728 mdecorde
      System::Call 'user32::OpenClipboard(i $HWNDPARENT)'
399 728 mdecorde
400 728 mdecorde
      ${If} $1 == ">" ;Set
401 728 mdecorde
402 728 mdecorde
        ;Step 1: Clear the clipboard
403 728 mdecorde
        System::Call 'user32::EmptyClipboard()'
404 728 mdecorde
405 728 mdecorde
        ;Step 2: Allocate global heap
406 728 mdecorde
        StrLen $2 $0
407 728 mdecorde
        IntOp $2 $2 + 1
408 728 mdecorde
        System::Call 'kernel32::GlobalAlloc(i 2, i r2) i.r2'
409 728 mdecorde
410 728 mdecorde
        ;Step 3: Lock the handle
411 728 mdecorde
        System::Call 'kernel32::GlobalLock(i r2) i.r3'
412 728 mdecorde
413 728 mdecorde
        ;Step 4: Copy the text to locked clipboard buffer
414 728 mdecorde
        System::Call 'kernel32::lstrcpyA(i r3, t r0)'
415 728 mdecorde
416 728 mdecorde
        ;Step 5: Unlock the handle again
417 728 mdecorde
        System::Call 'kernel32::GlobalUnlock(i r2)'
418 728 mdecorde
419 728 mdecorde
        ;Step 6: Set the information to the clipboard
420 728 mdecorde
        System::Call 'user32::SetClipboardData(i 1, i r2)'
421 728 mdecorde
422 728 mdecorde
        StrCpy $0 ""
423 728 mdecorde
424 728 mdecorde
      ${ElseIf} $1 == "<" ;Get
425 728 mdecorde
426 728 mdecorde
        ;Step 1: Get clipboard data
427 728 mdecorde
        System::Call 'user32::GetClipboardData(i 1) i .r2'
428 728 mdecorde
429 728 mdecorde
        ;Step 2: Lock and copy data (kichik's fix)
430 728 mdecorde
        System::Call 'kernel32::GlobalLock(i r2) t .r0'
431 728 mdecorde
432 728 mdecorde
        ;Step 3: Unlock (kichik's fix)
433 728 mdecorde
        System::Call 'kernel32::GlobalUnlock(i r2)'
434 728 mdecorde
435 728 mdecorde
      ${ElseIf} $1 == "<>" ;Swap
436 728 mdecorde
437 728 mdecorde
        ;Step 1: Get clipboard data
438 728 mdecorde
        System::Call 'user32::GetClipboardData(i 1) i .r2'
439 728 mdecorde
440 728 mdecorde
        ;Step 2: Lock and copy data (kichik's fix)
441 728 mdecorde
        System::Call 'kernel32::GlobalLock(i r2) t .r4'
442 728 mdecorde
443 728 mdecorde
        ;Step 3: Unlock (kichik's fix)
444 728 mdecorde
        System::Call 'kernel32::GlobalUnlock(i r2)'
445 728 mdecorde
446 728 mdecorde
        ;Step 4: Clear the clipboard
447 728 mdecorde
        System::Call 'user32::EmptyClipboard()'
448 728 mdecorde
449 728 mdecorde
        ;Step 5: Allocate global heap
450 728 mdecorde
        StrLen $2 $0
451 728 mdecorde
        IntOp $2 $2 + 1
452 728 mdecorde
        System::Call 'kernel32::GlobalAlloc(i 2, i r2) i.r2'
453 728 mdecorde
454 728 mdecorde
        ;Step 6: Lock the handle
455 728 mdecorde
        System::Call 'kernel32::GlobalLock(i r2) i.r3'
456 728 mdecorde
457 728 mdecorde
        ;Step 7: Copy the text to locked clipboard buffer
458 728 mdecorde
        System::Call 'kernel32::lstrcpyA(i r3, t r0)'
459 728 mdecorde
460 728 mdecorde
        ;Step 8: Unlock the handle again
461 728 mdecorde
        System::Call 'kernel32::GlobalUnlock(i r2)'
462 728 mdecorde
463 728 mdecorde
        ;Step 9: Set the information to the clipboard
464 728 mdecorde
        System::Call 'user32::SetClipboardData(i 1, i r2)'
465 728 mdecorde
466 728 mdecorde
        StrCpy $0 $4
467 728 mdecorde
      ${Else} ;Clear
468 728 mdecorde
469 728 mdecorde
        ;Step 1: Clear the clipboard
470 728 mdecorde
        System::Call 'user32::EmptyClipboard()'
471 728 mdecorde
472 728 mdecorde
        StrCpy $0 ""
473 728 mdecorde
      ${EndIf}
474 728 mdecorde
475 728 mdecorde
      ;Close the clipboard
476 728 mdecorde
      System::Call 'user32::CloseClipboard()'
477 728 mdecorde
478 728 mdecorde
    /*After this point:
479 728 mdecorde
      ------------------------------------------
480 728 mdecorde
       $0 = OutVar (output)*/
481 728 mdecorde
482 728 mdecorde
      ;Return result to user
483 728 mdecorde
      Pop $4
484 728 mdecorde
      Pop $3
485 728 mdecorde
      Pop $2
486 728 mdecorde
      Pop $1
487 728 mdecorde
      Exch $0
488 728 mdecorde
    FunctionEnd
489 728 mdecorde
490 728 mdecorde
  !macroend
491 728 mdecorde
492 728 mdecorde
  # Function StrIOToNSIS
493 728 mdecorde
  ####################
494 728 mdecorde
495 728 mdecorde
  !macro FUNCTION_STRING_StrIOToNSIS
496 728 mdecorde
    !insertmacro STRFUNC_FUNC `StrIOToNSIS` `2004 "bluenet" - Based on functions by Amir Szekely, Joost Verburg, Dave Laundon and Diego Pedroso`
497 728 mdecorde
498 728 mdecorde
    /*After this point:
499 728 mdecorde
      ------------------------------------------
500 728 mdecorde
       $R0 = String (input/output)
501 728 mdecorde
       $R1 = StartCharPos (temp)
502 728 mdecorde
       $R2 = StrLen (temp)
503 728 mdecorde
       $R3 = TempStr (temp)
504 728 mdecorde
       $R4 = TempRepStr (temp)*/
505 728 mdecorde
506 728 mdecorde
      ;Get input from user
507 728 mdecorde
      Exch $R0
508 728 mdecorde
      Push $R1
509 728 mdecorde
      Push $R2
510 728 mdecorde
      Push $R3
511 728 mdecorde
      Push $R4
512 728 mdecorde
513 728 mdecorde
      ;Get "String" length
514 728 mdecorde
      StrLen $R2 $R0
515 728 mdecorde
516 728 mdecorde
      ;Loop until "String" end is reached
517 728 mdecorde
      ${For} $R1 0 $R2
518 728 mdecorde
        ;Get the next "String" characters
519 728 mdecorde
        StrCpy $R3 $R0 2 $R1
520 728 mdecorde
521 728 mdecorde
        ;Detect if current character is:
522 728 mdecorde
        ${If} $R3 == "\\" ;Back-slash
523 728 mdecorde
          StrCpy $R4 "\"
524 728 mdecorde
        ${ElseIf} $R3 == "\r" ;Carriage return
525 728 mdecorde
          StrCpy $R4 "$\r"
526 728 mdecorde
        ${ElseIf} $R3 == "\n" ;Line feed
527 728 mdecorde
          StrCpy $R4 "$\n"
528 728 mdecorde
        ${ElseIf} $R3 == "\t" ;Tab
529 728 mdecorde
          StrCpy $R4 "$\t"
530 728 mdecorde
        ${Else} ;Anything else
531 728 mdecorde
          StrCpy $R4 ""
532 728 mdecorde
        ${EndIf}
533 728 mdecorde
534 728 mdecorde
        ;Detect if "TempRepStr" is not empty
535 728 mdecorde
        ${If} $R4 != ""
536 728 mdecorde
          ;Replace the old characters with the new one
537 728 mdecorde
          StrCpy $R3 $R0 $R1
538 728 mdecorde
          IntOp $R1 $R1 + 2
539 728 mdecorde
          StrCpy $R0 $R0 "" $R1
540 728 mdecorde
          StrCpy $R0 "$R3$R4$R0"
541 728 mdecorde
          IntOp $R2 $R2 - 1 ;Decrease "StrLen"
542 728 mdecorde
          IntOp $R1 $R1 - 2 ;Go back to the next character
543 728 mdecorde
        ${EndIf}
544 728 mdecorde
      ${Next}
545 728 mdecorde
      Pop $R4
546 728 mdecorde
      Pop $R3
547 728 mdecorde
      Pop $R2
548 728 mdecorde
      Pop $R1
549 728 mdecorde
      Exch $R0
550 728 mdecorde
    FunctionEnd
551 728 mdecorde
  !macroend
552 728 mdecorde
553 728 mdecorde
  # Function StrLoc
554 728 mdecorde
  ###############
555 728 mdecorde
556 728 mdecorde
  !macro FUNCTION_STRING_StrLoc
557 728 mdecorde
    !insertmacro STRFUNC_FUNC `StrLoc` `2004 Diego Pedroso - Based on functions by Ximon Eighteen`
558 728 mdecorde
559 728 mdecorde
    /*After this point:
560 728 mdecorde
      ------------------------------------------
561 728 mdecorde
       $R0 = OffsetDirection (input)
562 728 mdecorde
       $R1 = StrToSearch (input)
563 728 mdecorde
       $R2 = String (input)
564 728 mdecorde
       $R3 = StrToSearchLen (temp)
565 728 mdecorde
       $R4 = StrLen (temp)
566 728 mdecorde
       $R5 = StartCharPos (temp)
567 728 mdecorde
       $R6 = TempStr (temp)*/
568 728 mdecorde
569 728 mdecorde
      ;Get input from user
570 728 mdecorde
      Exch $R0
571 728 mdecorde
      Exch
572 728 mdecorde
      Exch $R1
573 728 mdecorde
      Exch 2
574 728 mdecorde
      Exch $R2
575 728 mdecorde
      Push $R3
576 728 mdecorde
      Push $R4
577 728 mdecorde
      Push $R5
578 728 mdecorde
      Push $R6
579 728 mdecorde
580 728 mdecorde
      ;Get "String" and "StrToSearch" length
581 728 mdecorde
      StrLen $R3 $R1
582 728 mdecorde
      StrLen $R4 $R2
583 728 mdecorde
      ;Start "StartCharPos" counter
584 728 mdecorde
      StrCpy $R5 0
585 728 mdecorde
586 728 mdecorde
      ;Loop until "StrToSearch" is found or "String" reaches its end
587 728 mdecorde
      ${Do}
588 728 mdecorde
        ;Remove everything before and after the searched part ("TempStr")
589 728 mdecorde
        StrCpy $R6 $R2 $R3 $R5
590 728 mdecorde
591 728 mdecorde
        ;Compare "TempStr" with "StrToSearch"
592 728 mdecorde
        ${If} $R6 == $R1
593 728 mdecorde
          ${If} $R0 == `<`
594 728 mdecorde
            IntOp $R6 $R3 + $R5
595 728 mdecorde
            IntOp $R0 $R4 - $R6
596 728 mdecorde
          ${Else}
597 728 mdecorde
            StrCpy $R0 $R5
598 728 mdecorde
          ${EndIf}
599 728 mdecorde
          ${ExitDo}
600 728 mdecorde
        ${EndIf}
601 728 mdecorde
        ;If not "StrToSearch", this could be "String" end
602 728 mdecorde
        ${If} $R5 >= $R4
603 728 mdecorde
          StrCpy $R0 ``
604 728 mdecorde
          ${ExitDo}
605 728 mdecorde
        ${EndIf}
606 728 mdecorde
        ;If not, continue the loop
607 728 mdecorde
        IntOp $R5 $R5 + 1
608 728 mdecorde
      ${Loop}
609 728 mdecorde
610 728 mdecorde
      ;Return output to user
611 728 mdecorde
      Pop $R6
612 728 mdecorde
      Pop $R5
613 728 mdecorde
      Pop $R4
614 728 mdecorde
      Pop $R3
615 728 mdecorde
      Pop $R2
616 728 mdecorde
      Exch
617 728 mdecorde
      Pop $R1
618 728 mdecorde
      Exch $R0
619 728 mdecorde
    FunctionEnd
620 728 mdecorde
621 728 mdecorde
  !macroend
622 728 mdecorde
623 728 mdecorde
  # Function StrNSISToIO
624 728 mdecorde
  ####################
625 728 mdecorde
626 728 mdecorde
  !macro FUNCTION_STRING_StrNSISToIO
627 728 mdecorde
    !insertmacro STRFUNC_FUNC `StrNSISToIO` `2004 "bluenet" - Based on functions by Amir Szekely, Joost Verburg, Dave Laundon and Diego Pedroso`
628 728 mdecorde
629 728 mdecorde
    /*After this point:
630 728 mdecorde
      ------------------------------------------
631 728 mdecorde
       $R0 = String (input/output)
632 728 mdecorde
       $R1 = StartCharPos (temp)
633 728 mdecorde
       $R2 = StrLen (temp)
634 728 mdecorde
       $R3 = TempStr (temp)
635 728 mdecorde
       $R4 = TempRepStr (temp)*/
636 728 mdecorde
637 728 mdecorde
      ;Get input from user
638 728 mdecorde
      Exch $R0
639 728 mdecorde
      Push $R1
640 728 mdecorde
      Push $R2
641 728 mdecorde
      Push $R3
642 728 mdecorde
      Push $R4
643 728 mdecorde
644 728 mdecorde
      ;Get "String" length
645 728 mdecorde
      StrLen $R2 $R0
646 728 mdecorde
647 728 mdecorde
      ;Loop until "String" end is reached
648 728 mdecorde
      ${For} $R1 0 $R2
649 728 mdecorde
        ;Get the next "String" character
650 728 mdecorde
        StrCpy $R3 $R0 1 $R1
651 728 mdecorde
652 728 mdecorde
        ;Detect if current character is:
653 728 mdecorde
        ${If} $R3 == "$\r" ;Back-slash
654 728 mdecorde
          StrCpy $R4 "\r"
655 728 mdecorde
        ${ElseIf} $R3 == "$\n" ;Carriage return
656 728 mdecorde
          StrCpy $R4 "\n"
657 728 mdecorde
        ${ElseIf} $R3 == "$\t" ;Line feed
658 728 mdecorde
          StrCpy $R4 "\t"
659 728 mdecorde
        ${ElseIf} $R3 == "\" ;Tab
660 728 mdecorde
          StrCpy $R4 "\\"
661 728 mdecorde
        ${Else} ;Anything else
662 728 mdecorde
          StrCpy $R4 ""
663 728 mdecorde
        ${EndIf}
664 728 mdecorde
665 728 mdecorde
        ;Detect if "TempRepStr" is not empty
666 728 mdecorde
        ${If} $R4 != ""
667 728 mdecorde
          ;Replace the old character with the new ones
668 728 mdecorde
          StrCpy $R3 $R0 $R1
669 728 mdecorde
          IntOp $R1 $R1 + 1
670 728 mdecorde
          StrCpy $R0 $R0 "" $R1
671 728 mdecorde
          StrCpy $R0 "$R3$R4$R0"
672 728 mdecorde
          IntOp $R2 $R2 + 1 ;Increase "StrLen"
673 728 mdecorde
        ${EndIf}
674 728 mdecorde
      ${Next}
675 728 mdecorde
676 728 mdecorde
      ;Return output to user
677 728 mdecorde
      Pop $R4
678 728 mdecorde
      Pop $R3
679 728 mdecorde
      Pop $R2
680 728 mdecorde
      Pop $R1
681 728 mdecorde
      Exch $R0
682 728 mdecorde
    FunctionEnd
683 728 mdecorde
  !macroend
684 728 mdecorde
685 728 mdecorde
  # Function StrRep
686 728 mdecorde
  ###############
687 728 mdecorde
688 728 mdecorde
  !macro FUNCTION_STRING_StrRep
689 728 mdecorde
    !insertmacro STRFUNC_FUNC `StrRep` `2004 Diego Pedroso - Based on functions by Hendri Adriaens`
690 728 mdecorde
691 728 mdecorde
    /*After this point:
692 728 mdecorde
      ------------------------------------------
693 728 mdecorde
       $R0 = ReplacementString (input)
694 728 mdecorde
       $R1 = StrToSearch (input)
695 728 mdecorde
       $R2 = String (input)
696 728 mdecorde
       $R3 = RepStrLen (temp)
697 728 mdecorde
       $R4 = StrToSearchLen (temp)
698 728 mdecorde
       $R5 = StrLen (temp)
699 728 mdecorde
       $R6 = StartCharPos (temp)
700 728 mdecorde
       $R7 = TempStrL (temp)
701 728 mdecorde
       $R8 = TempStrR (temp)*/
702 728 mdecorde
703 728 mdecorde
      ;Get input from user
704 728 mdecorde
      Exch $R0
705 728 mdecorde
      Exch
706 728 mdecorde
      Exch $R1
707 728 mdecorde
      Exch
708 728 mdecorde
      Exch 2
709 728 mdecorde
      Exch $R2
710 728 mdecorde
      Push $R3
711 728 mdecorde
      Push $R4
712 728 mdecorde
      Push $R5
713 728 mdecorde
      Push $R6
714 728 mdecorde
      Push $R7
715 728 mdecorde
      Push $R8
716 728 mdecorde
717 728 mdecorde
      ;Return "String" if "StrToSearch" is ""
718 728 mdecorde
      ${IfThen} $R1 == "" ${|} Goto Done ${|}
719 728 mdecorde
720 728 mdecorde
      ;Get "ReplacementString", "String" and "StrToSearch" length
721 728 mdecorde
      StrLen $R3 $R0
722 728 mdecorde
      StrLen $R4 $R1
723 728 mdecorde
      StrLen $R5 $R2
724 728 mdecorde
      ;Start "StartCharPos" counter
725 728 mdecorde
      StrCpy $R6 0
726 728 mdecorde
727 728 mdecorde
      ;Loop until "StrToSearch" is found or "String" reaches its end
728 728 mdecorde
      ${Do}
729 728 mdecorde
        ;Remove everything before and after the searched part ("TempStrL")
730 728 mdecorde
        StrCpy $R7 $R2 $R4 $R6
731 728 mdecorde
732 728 mdecorde
        ;Compare "TempStrL" with "StrToSearch"
733 728 mdecorde
        ${If} $R7 == $R1
734 728 mdecorde
          ;Split "String" to replace the string wanted
735 728 mdecorde
          StrCpy $R7 $R2 $R6 ;TempStrL
736 728 mdecorde
737 728 mdecorde
          ;Calc: "StartCharPos" + "StrToSearchLen" = EndCharPos
738 728 mdecorde
          IntOp $R8 $R6 + $R4
739 728 mdecorde
740 728 mdecorde
          StrCpy $R8 $R2 "" $R8 ;TempStrR
741 728 mdecorde
742 728 mdecorde
          ;Insert the new string between the two separated parts of "String"
743 728 mdecorde
          StrCpy $R2 $R7$R0$R8
744 728 mdecorde
          ;Now calculate the new "StrLen" and "StartCharPos"
745 728 mdecorde
          StrLen $R5 $R2
746 728 mdecorde
          IntOp $R6 $R6 + $R3
747 728 mdecorde
          ${Continue}
748 728 mdecorde
        ${EndIf}
749 728 mdecorde
750 728 mdecorde
        ;If not "StrToSearch", this could be "String" end
751 728 mdecorde
        ${IfThen} $R6 >= $R5 ${|} ${ExitDo} ${|}
752 728 mdecorde
        ;If not, continue the loop
753 728 mdecorde
        IntOp $R6 $R6 + 1
754 728 mdecorde
      ${Loop}
755 728 mdecorde
756 728 mdecorde
      Done:
757 728 mdecorde
758 728 mdecorde
    /*After this point:
759 728 mdecorde
      ------------------------------------------
760 728 mdecorde
       $R0 = OutVar (output)*/
761 728 mdecorde
762 728 mdecorde
      ;Return output to user
763 728 mdecorde
      StrCpy $R0 $R2
764 728 mdecorde
      Pop $R8
765 728 mdecorde
      Pop $R7
766 728 mdecorde
      Pop $R6
767 728 mdecorde
      Pop $R5
768 728 mdecorde
      Pop $R4
769 728 mdecorde
      Pop $R3
770 728 mdecorde
      Pop $R2
771 728 mdecorde
      Pop $R1
772 728 mdecorde
      Exch $R0
773 728 mdecorde
    FunctionEnd
774 728 mdecorde
775 728 mdecorde
  !macroend
776 728 mdecorde
777 728 mdecorde
  # Function StrSort
778 728 mdecorde
  ################
779 728 mdecorde
780 728 mdecorde
  !macro FUNCTION_STRING_StrSort
781 728 mdecorde
    !insertmacro STRFUNC_FUNC `StrSort` `2004 Diego Pedroso - Based on functions by Stuart Welch`
782 728 mdecorde
783 728 mdecorde
    /*After this point:
784 728 mdecorde
      ------------------------------------------
785 728 mdecorde
       $R0 = String (input)
786 728 mdecorde
       $R1 = LeftStr (input)
787 728 mdecorde
       $R2 = CenterStr (input)
788 728 mdecorde
       $R3 = RightStr (input)
789 728 mdecorde
       $R4 = IncludeLeftStr (input)
790 728 mdecorde
       $R5 = IncludeCenterStr (input)
791 728 mdecorde
       $R6 = IncludeRightStr (input)
792 728 mdecorde
793 728 mdecorde
       $0 = StrLen (temp)
794 728 mdecorde
       $1 = LeftStrLen (temp)
795 728 mdecorde
       $2 = CenterStrLen (temp)
796 728 mdecorde
       $3 = RightStrLen (temp)
797 728 mdecorde
       $4 = StartPos (temp)
798 728 mdecorde
       $5 = EndPos (temp)
799 728 mdecorde
       $6 = StartCharPos (temp)
800 728 mdecorde
       $7 = EndCharPos (temp)
801 728 mdecorde
       $8 = TempStr (temp)*/
802 728 mdecorde
803 728 mdecorde
      ;Get input from user
804 728 mdecorde
      Exch $R6
805 728 mdecorde
      Exch
806 728 mdecorde
      Exch $R5
807 728 mdecorde
      Exch
808 728 mdecorde
      Exch 2
809 728 mdecorde
      Exch $R4
810 728 mdecorde
      Exch 2
811 728 mdecorde
      Exch 3
812 728 mdecorde
      Exch $R3
813 728 mdecorde
      Exch 3
814 728 mdecorde
      Exch 4
815 728 mdecorde
      Exch $R2
816 728 mdecorde
      Exch 4
817 728 mdecorde
      Exch 5
818 728 mdecorde
      Exch $R1
819 728 mdecorde
      Exch 5
820 728 mdecorde
      Exch 6
821 728 mdecorde
      Exch $R0
822 728 mdecorde
      Exch 6
823 728 mdecorde
      Push $0
824 728 mdecorde
      Push $1
825 728 mdecorde
      Push $2
826 728 mdecorde
      Push $3
827 728 mdecorde
      Push $4
828 728 mdecorde
      Push $5
829 728 mdecorde
      Push $6
830 728 mdecorde
      Push $7
831 728 mdecorde
      Push $8
832 728 mdecorde
833 728 mdecorde
      ;Parameter defaults
834 728 mdecorde
      ${IfThen} $R4 == `` ${|} StrCpy $R4 `1` ${|}
835 728 mdecorde
      ${IfThen} $R5 == `` ${|} StrCpy $R5 `1` ${|}
836 728 mdecorde
      ${IfThen} $R6 == `` ${|} StrCpy $R6 `1` ${|}
837 728 mdecorde
838 728 mdecorde
      ;Get "String", "CenterStr", "LeftStr" and "RightStr" length
839 728 mdecorde
      StrLen $0 $R0
840 728 mdecorde
      StrLen $1 $R1
841 728 mdecorde
      StrLen $2 $R2
842 728 mdecorde
      StrLen $3 $R3
843 728 mdecorde
      ;Start "StartCharPos" counter
844 728 mdecorde
      StrCpy $6 0
845 728 mdecorde
      ;Start "EndCharPos" counter based on "CenterStr" length
846 728 mdecorde
      IntOp $7 $6 + $2
847 728 mdecorde
848 728 mdecorde
      ;Loop until "CenterStr" is found or "String" reaches its end
849 728 mdecorde
      ${Do}
850 728 mdecorde
        ;Remove everything before and after the searched part ("TempStr")
851 728 mdecorde
        StrCpy $8 $R0 $2 $6
852 728 mdecorde
853 728 mdecorde
        ;Compare "TempStr" with "CenterStr"
854 728 mdecorde
        ${IfThen} $8 == $R2 ${|} ${ExitDo} ${|}
855 728 mdecorde
        ;If not, this could be "String" end
856 728 mdecorde
        ${IfThen} $7 >= $0 ${|} Goto Done ${|}
857 728 mdecorde
        ;If not, continue the loop
858 728 mdecorde
        IntOp $6 $6 + 1
859 728 mdecorde
        IntOp $7 $7 + 1
860 728 mdecorde
      ${Loop}
861 728 mdecorde
862 728 mdecorde
      # "CenterStr" was found
863 728 mdecorde
864 728 mdecorde
      ;Remove "CenterStr" from "String" if the user wants
865 728 mdecorde
      ${If} $R5 = ${FALSE}
866 728 mdecorde
        StrCpy $8 $R0 $6
867 728 mdecorde
        StrCpy $R0 $R0 `` $7
868 728 mdecorde
        StrCpy $R0 $8$R0
869 728 mdecorde
      ${EndIf}
870 728 mdecorde
871 728 mdecorde
      ;"StartPos" and "EndPos" will record "CenterStr" coordinates for now
872 728 mdecorde
      StrCpy $4 $6
873 728 mdecorde
      StrCpy $5 $7
874 728 mdecorde
      ;"StartCharPos" and "EndCharPos" should be before "CenterStr"
875 728 mdecorde
      IntOp $6 $6 - $1
876 728 mdecorde
      IntOp $7 $6 + $1
877 728 mdecorde
878 728 mdecorde
      ;Loop until "LeftStr" is found or "String" reaches its start
879 728 mdecorde
      ${Do}
880 728 mdecorde
        ;Remove everything before and after the searched part ("TempStr")
881 728 mdecorde
        StrCpy $8 $R0 $1 $6
882 728 mdecorde
883 728 mdecorde
        ;If "LeftStr" is empty
884 728 mdecorde
        ${If} $R1 == ``
885 728 mdecorde
          StrCpy $6 0
886 728 mdecorde
          StrCpy $7 0
887 728 mdecorde
          ${ExitDo}
888 728 mdecorde
        ${EndIf}
889 728 mdecorde
890 728 mdecorde
        ;Compare "TempStr" with "LeftStr"
891 728 mdecorde
        ${IfThen} $8 == $R1 ${|} ${ExitDo} ${|}
892 728 mdecorde
        ;If not, this could be "String" start
893 728 mdecorde
        ${IfThen} $6 <= 0 ${|} ${ExitDo} ${|}
894 728 mdecorde
        ;If not, continue the loop
895 728 mdecorde
        IntOp $6 $6 - 1
896 728 mdecorde
        IntOp $7 $7 - 1
897 728 mdecorde
      ${Loop}
898 728 mdecorde
899 728 mdecorde
      # "LeftStr" is found or "String" start was reached
900 728 mdecorde
901 728 mdecorde
      ;Remove "LeftStr" from "String" if the user wants
902 728 mdecorde
      ${If} $R4 = ${FALSE}
903 728 mdecorde
        IntOp $6 $6 + $1
904 728 mdecorde
      ${EndIf}
905 728 mdecorde
906 728 mdecorde
      ;Record "LeftStr" first character position on "TempStr" (temporarily)
907 728 mdecorde
      StrCpy $8 $6
908 728 mdecorde
909 728 mdecorde
      ;"StartCharPos" and "EndCharPos" should be after "CenterStr"
910 728 mdecorde
      ${If} $R5 = ${FALSE}
911 728 mdecorde
        StrCpy $6 $4
912 728 mdecorde
      ${Else}
913 728 mdecorde
        IntOp $6 $4 + $2
914 728 mdecorde
      ${EndIf}
915 728 mdecorde
      IntOp $7 $6 + $3
916 728 mdecorde
917 728 mdecorde
      ;Record "LeftStr" first character position on "StartPos"
918 728 mdecorde
      StrCpy $4 $8
919 728 mdecorde
920 728 mdecorde
      ;Loop until "RightStr" is found or "String" reaches its end
921 728 mdecorde
      ${Do}
922 728 mdecorde
        ;Remove everything before and after the searched part ("TempStr")
923 728 mdecorde
        StrCpy $8 $R0 $3 $6
924 728 mdecorde
925 728 mdecorde
        ;If "RightStr" is empty
926 728 mdecorde
        ${If} $R3 == ``
927 728 mdecorde
          StrCpy $6 $0
928 728 mdecorde
          StrCpy $7 $0
929 728 mdecorde
          ${ExitDo}
930 728 mdecorde
        ${EndIf}
931 728 mdecorde
932 728 mdecorde
        ;Compare "TempStr" with "RightStr"
933 728 mdecorde
        ${IfThen} $8 == $R3 ${|} ${ExitDo} ${|}
934 728 mdecorde
        ;If not, this could be "String" end
935 728 mdecorde
        ${IfThen} $7 >= $0 ${|} ${ExitDo} ${|}
936 728 mdecorde
        ;If not, continue the loop
937 728 mdecorde
        IntOp $6 $6 + 1
938 728 mdecorde
        IntOp $7 $7 + 1
939 728 mdecorde
      ${Loop}
940 728 mdecorde
941 728 mdecorde
      ;Remove "RightStr" from "String" if the user wants
942 728 mdecorde
      ${If} $R6 = ${FALSE}
943 728 mdecorde
        IntOp $7 $7 - $3
944 728 mdecorde
      ${EndIf}
945 728 mdecorde
946 728 mdecorde
      ;Record "RightStr" last character position on "StartPos"
947 728 mdecorde
      StrCpy $5 $7
948 728 mdecorde
949 728 mdecorde
      ;As the positionment is relative...
950 728 mdecorde
      IntOp $5 $5 - $4
951 728 mdecorde
952 728 mdecorde
      ;Write the string and finish the job
953 728 mdecorde
      StrCpy $R0 $R0 $5 $4
954 728 mdecorde
      Goto +2
955 728 mdecorde
956 728 mdecorde
      Done:
957 728 mdecorde
      StrCpy $R0 ``
958 728 mdecorde
959 728 mdecorde
    /*After this point:
960 728 mdecorde
      ------------------------------------------
961 728 mdecorde
       $R0 = OutVar (output)*/
962 728 mdecorde
963 728 mdecorde
      ;Return output to user
964 728 mdecorde
      Pop $8
965 728 mdecorde
      Pop $7
966 728 mdecorde
      Pop $6
967 728 mdecorde
      Pop $5
968 728 mdecorde
      Pop $4
969 728 mdecorde
      Pop $3
970 728 mdecorde
      Pop $2
971 728 mdecorde
      Pop $1
972 728 mdecorde
      Pop $0
973 728 mdecorde
      Pop $R6
974 728 mdecorde
      Pop $R5
975 728 mdecorde
      Pop $R4
976 728 mdecorde
      Pop $R3
977 728 mdecorde
      Pop $R2
978 728 mdecorde
      Pop $R1
979 728 mdecorde
      Exch $R0
980 728 mdecorde
    FunctionEnd
981 728 mdecorde
982 728 mdecorde
  !macroend
983 728 mdecorde
984 728 mdecorde
  # Function StrStr
985 728 mdecorde
  ###############
986 728 mdecorde
987 728 mdecorde
  !macro FUNCTION_STRING_StrStr
988 728 mdecorde
    !insertmacro STRFUNC_FUNC `StrStr` `2004 Diego Pedroso - Based on functions by Ximon Eighteen`
989 728 mdecorde
990 728 mdecorde
    /*After this point:
991 728 mdecorde
      ------------------------------------------
992 728 mdecorde
       $R0 = StrToSearch (input)
993 728 mdecorde
       $R1 = String (input)
994 728 mdecorde
       $R2 = StrToSearchLen (temp)
995 728 mdecorde
       $R3 = StrLen (temp)
996 728 mdecorde
       $R4 = StartCharPos (temp)
997 728 mdecorde
       $R5 = TempStr (temp)*/
998 728 mdecorde
999 728 mdecorde
      ;Get input from user
1000 728 mdecorde
      Exch $R0
1001 728 mdecorde
      Exch
1002 728 mdecorde
      Exch $R1
1003 728 mdecorde
      Push $R2
1004 728 mdecorde
      Push $R3
1005 728 mdecorde
      Push $R4
1006 728 mdecorde
      Push $R5
1007 728 mdecorde
1008 728 mdecorde
      ;Get "String" and "StrToSearch" length
1009 728 mdecorde
      StrLen $R2 $R0
1010 728 mdecorde
      StrLen $R3 $R1
1011 728 mdecorde
      ;Start "StartCharPos" counter
1012 728 mdecorde
      StrCpy $R4 0
1013 728 mdecorde
1014 728 mdecorde
      ;Loop until "StrToSearch" is found or "String" reaches its end
1015 728 mdecorde
      ${Do}
1016 728 mdecorde
        ;Remove everything before and after the searched part ("TempStr")
1017 728 mdecorde
        StrCpy $R5 $R1 $R2 $R4
1018 728 mdecorde
1019 728 mdecorde
        ;Compare "TempStr" with "StrToSearch"
1020 728 mdecorde
        ${IfThen} $R5 == $R0 ${|} ${ExitDo} ${|}
1021 728 mdecorde
        ;If not "StrToSearch", this could be "String" end
1022 728 mdecorde
        ${IfThen} $R4 >= $R3 ${|} ${ExitDo} ${|}
1023 728 mdecorde
        ;If not, continue the loop
1024 728 mdecorde
        IntOp $R4 $R4 + 1
1025 728 mdecorde
      ${Loop}
1026 728 mdecorde
1027 728 mdecorde
    /*After this point:
1028 728 mdecorde
      ------------------------------------------
1029 728 mdecorde
       $R0 = OutVar (output)*/
1030 728 mdecorde
1031 728 mdecorde
      ;Remove part before "StrToSearch" on "String" (if there has one)
1032 728 mdecorde
      StrCpy $R0 $R1 `` $R4
1033 728 mdecorde
1034 728 mdecorde
      ;Return output to user
1035 728 mdecorde
      Pop $R5
1036 728 mdecorde
      Pop $R4
1037 728 mdecorde
      Pop $R3
1038 728 mdecorde
      Pop $R2
1039 728 mdecorde
      Pop $R1
1040 728 mdecorde
      Exch $R0
1041 728 mdecorde
    FunctionEnd
1042 728 mdecorde
1043 728 mdecorde
  !macroend
1044 728 mdecorde
1045 728 mdecorde
  # Function StrStrAdv
1046 728 mdecorde
  ##################
1047 728 mdecorde
1048 728 mdecorde
  !macro FUNCTION_STRING_StrStrAdv
1049 728 mdecorde
    !insertmacro STRFUNC_FUNC `StrStrAdv` `2003-2004 Diego Pedroso`
1050 728 mdecorde
1051 728 mdecorde
    /*After this point:
1052 728 mdecorde
      ------------------------------------------
1053 728 mdecorde
       $0 = String (input)
1054 728 mdecorde
       $1 = StringToSearch (input)
1055 728 mdecorde
       $2 = DirectionOfSearch (input)
1056 728 mdecorde
       $3 = DirectionOfReturn (input)
1057 728 mdecorde
       $4 = ShowStrToSearch (input)
1058 728 mdecorde
       $5 = NumLoops (input)
1059 728 mdecorde
       $6 = CaseSensitive (input)
1060 728 mdecorde
       $7 = StringLength (temp)
1061 728 mdecorde
       $8 = StrToSearchLength (temp)
1062 728 mdecorde
       $9 = CurrentLoop (temp)
1063 728 mdecorde
       $R0 = EndCharPos (temp)
1064 728 mdecorde
       $R1 = StartCharPos (temp)
1065 728 mdecorde
       $R2 = OutVar (output)
1066 728 mdecorde
       $R3 = Temp (temp)*/
1067 728 mdecorde
1068 728 mdecorde
      ;Get input from user
1069 728 mdecorde
1070 728 mdecorde
      Exch $6
1071 728 mdecorde
      Exch
1072 728 mdecorde
      Exch $5
1073 728 mdecorde
      Exch
1074 728 mdecorde
      Exch 2
1075 728 mdecorde
      Exch $4
1076 728 mdecorde
      Exch 2
1077 728 mdecorde
      Exch 3
1078 728 mdecorde
      Exch $3
1079 728 mdecorde
      Exch 3
1080 728 mdecorde
      Exch 4
1081 728 mdecorde
      Exch $2
1082 728 mdecorde
      Exch 4
1083 728 mdecorde
      Exch 5
1084 728 mdecorde
      Exch $1
1085 728 mdecorde
      Exch 5
1086 728 mdecorde
      Exch 6
1087 728 mdecorde
      Exch $0
1088 728 mdecorde
      Exch 6
1089 728 mdecorde
      Push $7
1090 728 mdecorde
      Push $8
1091 728 mdecorde
      Push $9
1092 728 mdecorde
      Push $R3
1093 728 mdecorde
      Push $R2
1094 728 mdecorde
      Push $R1
1095 728 mdecorde
      Push $R0
1096 728 mdecorde
1097 728 mdecorde
      ; Clean $R0-$R3 variables
1098 728 mdecorde
      StrCpy $R0 ""
1099 728 mdecorde
      StrCpy $R1 ""
1100 728 mdecorde
      StrCpy $R2 ""
1101 728 mdecorde
      StrCpy $R3 ""
1102 728 mdecorde
1103 728 mdecorde
      ; Verify if we have the correct values on the variables
1104 728 mdecorde
      ${If} $0 == ``
1105 728 mdecorde
        SetErrors ;AdvStrStr_StrToSearch not found
1106 728 mdecorde
        Goto AdvStrStr_End
1107 728 mdecorde
      ${EndIf}
1108 728 mdecorde
1109 728 mdecorde
      ${If} $1 == ``
1110 728 mdecorde
        SetErrors ;No text to search
1111 728 mdecorde
        Goto AdvStrStr_End
1112 728 mdecorde
      ${EndIf}
1113 728 mdecorde
1114 728 mdecorde
      ${If} $2 != <
1115 728 mdecorde
        StrCpy $2 >
1116 728 mdecorde
      ${EndIf}
1117 728 mdecorde
1118 728 mdecorde
      ${If} $3 != <
1119 728 mdecorde
        StrCpy $3 >
1120 728 mdecorde
      ${EndIf}
1121 728 mdecorde
1122 728 mdecorde
      ${If} $4 <> 0
1123 728 mdecorde
        StrCpy $4 1
1124 728 mdecorde
      ${EndIf}
1125 728 mdecorde
1126 728 mdecorde
      ${If} $5 <= 0
1127 728 mdecorde
        StrCpy $5 0
1128 728 mdecorde
      ${EndIf}
1129 728 mdecorde
1130 728 mdecorde
      ${If} $6 <> 1
1131 728 mdecorde
        StrCpy $6 0
1132 728 mdecorde
      ${EndIf}
1133 728 mdecorde
1134 728 mdecorde
      ; Find "AdvStrStr_String" length
1135 728 mdecorde
      StrLen $7 $0
1136 728 mdecorde
1137 728 mdecorde
      ; Then find "AdvStrStr_StrToSearch" length
1138 728 mdecorde
      StrLen $8 $1
1139 728 mdecorde
1140 728 mdecorde
      ; Now set up basic variables
1141 728 mdecorde
1142 728 mdecorde
      ${If} $2 == <
1143 728 mdecorde
        IntOp $R1 $7 - $8
1144 728 mdecorde
        StrCpy $R2 $7
1145 728 mdecorde
      ${Else}
1146 728 mdecorde
        StrCpy $R1 0
1147 728 mdecorde
        StrCpy $R2 $8
1148 728 mdecorde
      ${EndIf}
1149 728 mdecorde
1150 728 mdecorde
      StrCpy $9 0 ; First loop
1151 728 mdecorde
1152 728 mdecorde
      ;Let's begin the search
1153 728 mdecorde
1154 728 mdecorde
      ${Do}
1155 728 mdecorde
        ; Step 1: If the starting or ending numbers are negative
1156 728 mdecorde
        ;         or more than AdvStrStr_StringLen, we return
1157 728 mdecorde
        ;         error
1158 728 mdecorde
1159 728 mdecorde
        ${If} $R1 < 0
1160 728 mdecorde
          StrCpy $R1 ``
1161 728 mdecorde
          StrCpy $R2 ``
1162 728 mdecorde
          StrCpy $R3 ``
1163 728 mdecorde
          SetErrors ;AdvStrStr_StrToSearch not found
1164 728 mdecorde
          Goto AdvStrStr_End
1165 728 mdecorde
        ${ElseIf} $R2 > $7
1166 728 mdecorde
          StrCpy $R1 ``
1167 728 mdecorde
          StrCpy $R2 ``
1168 728 mdecorde
          StrCpy $R3 ``
1169 728 mdecorde
          SetErrors ;AdvStrStr_StrToSearch not found
1170 728 mdecorde
          Goto AdvStrStr_End
1171 728 mdecorde
        ${EndIf}
1172 728 mdecorde
1173 728 mdecorde
        ; Step 2: Start the search depending on
1174 728 mdecorde
        ;         AdvStrStr_DirectionOfSearch. Chop down not needed
1175 728 mdecorde
        ;         characters.
1176 728 mdecorde
1177 728 mdecorde
        ${If} $R1 <> 0
1178 728 mdecorde
          StrCpy $R3 $0 `` $R1
1179 728 mdecorde
        ${EndIf}
1180 728 mdecorde
1181 728 mdecorde
        ${If} $R2 <> $7
1182 728 mdecorde
          ${If} $R1 = 0
1183 728 mdecorde
            StrCpy $R3 $0 $8
1184 728 mdecorde
          ${Else}
1185 728 mdecorde
            StrCpy $R3 $R3 $8
1186 728 mdecorde
          ${EndIf}
1187 728 mdecorde
        ${EndIf}
1188 728 mdecorde
1189 728 mdecorde
        ; Step 3: Make sure that's the string we want
1190 728 mdecorde
1191 728 mdecorde
        ; Case-Sensitive Support <- Use "AdvStrStr_Temp"
1192 728 mdecorde
        ; variable because it won't be used anymore
1193 728 mdecorde
1194 728 mdecorde
        ${If} $6 == 1
1195 728 mdecorde
          System::Call `kernel32::lstrcmpA(ts, ts) i.s` `$R3` `$1`
1196 728 mdecorde
          Pop $R3
1197 728 mdecorde
          ${If} $R3 = 0
1198 728 mdecorde
            StrCpy $R3 1 ; Continue
1199 728 mdecorde
          ${Else}
1200 728 mdecorde
            StrCpy $R3 0 ; Break
1201 728 mdecorde
          ${EndIf}
1202 728 mdecorde
        ${Else}
1203 728 mdecorde
          ${If} $R3 == $1
1204 728 mdecorde
            StrCpy $R3 1 ; Continue
1205 728 mdecorde
          ${Else}
1206 728 mdecorde
            StrCpy $R3 0 ; Break
1207 728 mdecorde
          ${EndIf}
1208 728 mdecorde
        ${EndIf}
1209 728 mdecorde
1210 728 mdecorde
        ; After the comparasion, confirm that it is the
1211 728 mdecorde
        ; value we want.
1212 728 mdecorde
1213 728 mdecorde
        ${If} $R3 = 1
1214 728 mdecorde
1215 728 mdecorde
          ;We found it, return except if the user has set up to
1216 728 mdecorde
          ;search for another one:
1217 728 mdecorde
          ${If} $9 >= $5
1218 728 mdecorde
1219 728 mdecorde
            ;Now, let's see if the user wants
1220 728 mdecorde
            ;AdvStrStr_StrToSearch to appear:
1221 728 mdecorde
            ${If} $4 == 0
1222 728 mdecorde
              ;Return depends on AdvStrStr_DirectionOfReturn
1223 728 mdecorde
              ${If} $3 == <
1224 728 mdecorde
                ; RTL
1225 728 mdecorde
                StrCpy $R0 $0 $R1
1226 728 mdecorde
              ${Else}
1227 728 mdecorde
                ; LTR
1228 728 mdecorde
                StrCpy $R0 $0 `` $R2
1229 728 mdecorde
              ${EndIf}
1230 728 mdecorde
              ${Break}
1231 728 mdecorde
            ${Else}
1232 728 mdecorde
              ;Return depends on AdvStrStr_DirectionOfReturn
1233 728 mdecorde
              ${If} $3 == <
1234 728 mdecorde
                ; RTL
1235 728 mdecorde
                StrCpy $R0 $0 $R2
1236 728 mdecorde
              ${Else}
1237 728 mdecorde
                ; LTR
1238 728 mdecorde
                StrCpy $R0 $0 `` $R1
1239 728 mdecorde
              ${EndIf}
1240 728 mdecorde
              ${Break}
1241 728 mdecorde
            ${EndIf}
1242 728 mdecorde
          ${Else}
1243 728 mdecorde
            ;If the user wants to have more loops, let's do it so!
1244 728 mdecorde
            IntOp $9 $9 + 1
1245 728 mdecorde
1246 728 mdecorde
            ${If} $2 == <
1247 728 mdecorde
              IntOp $R1 $R1 - 1
1248 728 mdecorde
              IntOp $R2 $R2 - 1
1249 728 mdecorde
            ${Else}
1250 728 mdecorde
              IntOp $R1 $R1 + 1
1251 728 mdecorde
              IntOp $R2 $R2 + 1
1252 728 mdecorde
            ${EndIf}
1253 728 mdecorde
          ${EndIf}
1254 728 mdecorde
        ${Else}
1255 728 mdecorde
          ; Step 4: We didn't find it, so do steps 1 thru 3 again
1256 728 mdecorde
1257 728 mdecorde
          ${If} $2 == <
1258 728 mdecorde
            IntOp $R1 $R1 - 1
1259 728 mdecorde
            IntOp $R2 $R2 - 1
1260 728 mdecorde
          ${Else}
1261 728 mdecorde
            IntOp $R1 $R1 + 1
1262 728 mdecorde
            IntOp $R2 $R2 + 1
1263 728 mdecorde
          ${EndIf}
1264 728 mdecorde
        ${EndIf}
1265 728 mdecorde
      ${Loop}
1266 728 mdecorde
1267 728 mdecorde
      AdvStrStr_End:
1268 728 mdecorde
1269 728 mdecorde
      ;Add 1 to AdvStrStr_EndCharPos to be supportable
1270 728 mdecorde
      ;by "StrCpy"
1271 728 mdecorde
1272 728 mdecorde
      IntOp $R2 $R2 - 1
1273 728 mdecorde
1274 728 mdecorde
      ;Return output to user
1275 728 mdecorde
1276 728 mdecorde
      Exch $R0
1277 728 mdecorde
      Exch
1278 728 mdecorde
      Pop $R1
1279 728 mdecorde
      Exch
1280 728 mdecorde
      Pop $R2
1281 728 mdecorde
      Exch
1282 728 mdecorde
      Pop $R3
1283 728 mdecorde
      Exch
1284 728 mdecorde
      Pop $9
1285 728 mdecorde
      Exch
1286 728 mdecorde
      Pop $8
1287 728 mdecorde
      Exch
1288 728 mdecorde
      Pop $7
1289 728 mdecorde
      Exch
1290 728 mdecorde
      Pop $6
1291 728 mdecorde
      Exch
1292 728 mdecorde
      Pop $5
1293 728 mdecorde
      Exch
1294 728 mdecorde
      Pop $4
1295 728 mdecorde
      Exch
1296 728 mdecorde
      Pop $3
1297 728 mdecorde
      Exch
1298 728 mdecorde
      Pop $2
1299 728 mdecorde
      Exch
1300 728 mdecorde
      Pop $1
1301 728 mdecorde
      Exch
1302 728 mdecorde
      Pop $0
1303 728 mdecorde
1304 728 mdecorde
    FunctionEnd
1305 728 mdecorde
1306 728 mdecorde
  !macroend
1307 728 mdecorde
1308 728 mdecorde
  # Function StrTok
1309 728 mdecorde
  ###############
1310 728 mdecorde
1311 728 mdecorde
  !macro FUNCTION_STRING_StrTok
1312 728 mdecorde
    !insertmacro STRFUNC_FUNC `StrTok` `2004 Diego Pedroso - Based on functions by "bigmac666"`
1313 728 mdecorde
    /*After this point:
1314 728 mdecorde
      ------------------------------------------
1315 728 mdecorde
       $0 = SkipEmptyParts (input)
1316 728 mdecorde
       $1 = ResultPart (input)
1317 728 mdecorde
       $2 = Separators (input)
1318 728 mdecorde
       $3 = String (input)
1319 728 mdecorde
       $4 = StrToSearchLen (temp)
1320 728 mdecorde
       $5 = StrLen (temp)
1321 728 mdecorde
       $6 = StartCharPos (temp)
1322 728 mdecorde
       $7 = TempStr (temp)
1323 728 mdecorde
       $8 = CurrentLoop
1324 728 mdecorde
       $9 = CurrentSepChar
1325 728 mdecorde
       $R0 = CurrentSepCharNum
1326 728 mdecorde
       */
1327 728 mdecorde
1328 728 mdecorde
      ;Get input from user
1329 728 mdecorde
      Exch $0
1330 728 mdecorde
      Exch
1331 728 mdecorde
      Exch $1
1332 728 mdecorde
      Exch
1333 728 mdecorde
      Exch 2
1334 728 mdecorde
      Exch $2
1335 728 mdecorde
      Exch 2
1336 728 mdecorde
      Exch 3
1337 728 mdecorde
      Exch $3
1338 728 mdecorde
      Exch 3
1339 728 mdecorde
      Push $4
1340 728 mdecorde
      Push $5
1341 728 mdecorde
      Push $6
1342 728 mdecorde
      Push $7
1343 728 mdecorde
      Push $8
1344 728 mdecorde
      Push $9
1345 728 mdecorde
      Push $R0
1346 728 mdecorde
1347 728 mdecorde
      ;Parameter defaults
1348 728 mdecorde
      ${IfThen} $2 == `` ${|} StrCpy $2 `|` ${|}
1349 728 mdecorde
      ${IfThen} $1 == `` ${|} StrCpy $1 `L` ${|}
1350 728 mdecorde
      ${IfThen} $0 == `` ${|} StrCpy $0 `0` ${|}
1351 728 mdecorde
1352 728 mdecorde
      ;Get "String" and "StrToSearch" length
1353 728 mdecorde
      StrLen $4 $2
1354 728 mdecorde
      StrLen $5 $3
1355 728 mdecorde
      ;Start "StartCharPos" and "ResultPart" counters
1356 728 mdecorde
      StrCpy $6 0
1357 728 mdecorde
      StrCpy $8 -1
1358 728 mdecorde
1359 728 mdecorde
      ;Loop until "ResultPart" is met, "StrToSearch" is found or
1360 728 mdecorde
      ;"String" reaches its end
1361 728 mdecorde
      ResultPartLoop: ;"CurrentLoop" Loop
1362 728 mdecorde
1363 728 mdecorde
        ;Increase "CurrentLoop" counter
1364 728 mdecorde
        IntOp $8 $8 + 1
1365 728 mdecorde
1366 728 mdecorde
        StrSearchLoop:
1367 728 mdecorde
        ${Do} ;"String" Loop
1368 728 mdecorde
          ;Remove everything before and after the searched part ("TempStr")
1369 728 mdecorde
          StrCpy $7 $3 1 $6
1370 728 mdecorde
1371 728 mdecorde
          ;Verify if it's the "String" end
1372 728 mdecorde
          ${If} $6 >= $5
1373 728 mdecorde
            ;If "CurrentLoop" is what the user wants, remove the part
1374 728 mdecorde
            ;after "TempStr" and itself and get out of here
1375 728 mdecorde
            ${If} $8 == $1
1376 728 mdecorde
            ${OrIf} $1 == `L`
1377 728 mdecorde
              StrCpy $3 $3 $6
1378 728 mdecorde
            ${Else} ;If not, empty "String" and get out of here
1379 728 mdecorde
              StrCpy $3 ``
1380 728 mdecorde
            ${EndIf}
1381 728 mdecorde
            StrCpy $R0 `End`
1382 728 mdecorde
            ${ExitDo}
1383 728 mdecorde
          ${EndIf}
1384 728 mdecorde
1385 728 mdecorde
          ;Start "CurrentSepCharNum" counter (for "Separators" Loop)
1386 728 mdecorde
          StrCpy $R0 0
1387 728 mdecorde
1388 728 mdecorde
          ${Do} ;"Separators" Loop
1389 728 mdecorde
            ;Use one "Separators" character at a time
1390 728 mdecorde
            ${If} $R0 <> 0
1391 728 mdecorde
              StrCpy $9 $2 1 $R0
1392 728 mdecorde
            ${Else}
1393 728 mdecorde
              StrCpy $9 $2 1
1394 728 mdecorde
            ${EndIf}
1395 728 mdecorde
1396 728 mdecorde
            ;Go to the next "String" char if it's "Separators" end
1397 728 mdecorde
            ${IfThen} $R0 >= $4 ${|} ${ExitDo} ${|}
1398 728 mdecorde
1399 728 mdecorde
            ;Or, if "TempStr" equals "CurrentSepChar", then...
1400 728 mdecorde
            ${If} $7 == $9
1401 728 mdecorde
              StrCpy $7 $3 $6
1402 728 mdecorde
1403 728 mdecorde
              ;If "String" is empty because this result part doesn't
1404 728 mdecorde
              ;contain data, verify if "SkipEmptyParts" is activated,
1405 728 mdecorde
              ;so we don't return the output to user yet
1406 728 mdecorde
1407 728 mdecorde
              ${If} $7 == ``
1408 728 mdecorde
              ${AndIf} $0 = ${TRUE}
1409 728 mdecorde
                IntOp $6 $6 + 1
1410 728 mdecorde
                StrCpy $3 $3 `` $6
1411 728 mdecorde
                StrCpy $6 0
1412 728 mdecorde
                Goto StrSearchLoop
1413 728 mdecorde
              ${ElseIf} $8 == $1
1414 728 mdecorde
                StrCpy $3 $3 $6
1415 728 mdecorde
                StrCpy $R0 "End"
1416 728 mdecorde
                ${ExitDo}
1417 728 mdecorde
              ${EndIf} ;If not, go to the next result part
1418 728 mdecorde
              IntOp $6 $6 + 1
1419 728 mdecorde
              StrCpy $3 $3 `` $6
1420 728 mdecorde
              StrCpy $6 0
1421 728 mdecorde
              Goto ResultPartLoop
1422 728 mdecorde
            ${EndIf}
1423 728 mdecorde
1424 728 mdecorde
            ;Increase "CurrentSepCharNum" counter
1425 728 mdecorde
            IntOp $R0 $R0 + 1
1426 728 mdecorde
          ${Loop}
1427 728 mdecorde
          ${IfThen} $R0 == "End" ${|} ${ExitDo} ${|}
1428 728 mdecorde
1429 728 mdecorde
          ;Increase "StartCharPos" counter
1430 728 mdecorde
          IntOp $6 $6 + 1
1431 728 mdecorde
        ${Loop}
1432 728 mdecorde
1433 728 mdecorde
    /*After this point:
1434 728 mdecorde
      ------------------------------------------
1435 728 mdecorde
       $3 = OutVar (output)*/
1436 728 mdecorde
1437 728 mdecorde
      ;Return output to user
1438 728 mdecorde
1439 728 mdecorde
      Pop $R0
1440 728 mdecorde
      Pop $9
1441 728 mdecorde
      Pop $8
1442 728 mdecorde
      Pop $7
1443 728 mdecorde
      Pop $6
1444 728 mdecorde
      Pop $5
1445 728 mdecorde
      Pop $4
1446 728 mdecorde
      Pop $0
1447 728 mdecorde
      Pop $1
1448 728 mdecorde
      Pop $2
1449 728 mdecorde
      Exch $3
1450 728 mdecorde
    FunctionEnd
1451 728 mdecorde
1452 728 mdecorde
  !macroend
1453 728 mdecorde
1454 728 mdecorde
  # Function StrTrimNewLines
1455 728 mdecorde
  ########################
1456 728 mdecorde
1457 728 mdecorde
  !macro FUNCTION_STRING_StrTrimNewLines
1458 728 mdecorde
    !insertmacro STRFUNC_FUNC `StrTrimNewLines` `2004 Diego Pedroso - Based on functions by Ximon Eighteen`
1459 728 mdecorde
1460 728 mdecorde
    /*After this point:
1461 728 mdecorde
      ------------------------------------------
1462 728 mdecorde
       $R0 = String (input)
1463 728 mdecorde
       $R1 = TrimCounter (temp)
1464 728 mdecorde
       $R2 = Temp (temp)*/
1465 728 mdecorde
1466 728 mdecorde
      ;Get input from user
1467 728 mdecorde
      Exch $R0
1468 728 mdecorde
      Push $R1
1469 728 mdecorde
      Push $R2
1470 728 mdecorde
1471 728 mdecorde
      ;Initialize trim counter
1472 728 mdecorde
      StrCpy $R1 0
1473 728 mdecorde
1474 728 mdecorde
      loop:
1475 728 mdecorde
        ;Subtract to get "String"'s last characters
1476 728 mdecorde
        IntOp $R1 $R1 - 1
1477 728 mdecorde
1478 728 mdecorde
        ;Verify if they are either $\r or $\n
1479 728 mdecorde
        StrCpy $R2 $R0 1 $R1
1480 728 mdecorde
        ${If} $R2 == `$\r`
1481 728 mdecorde
        ${OrIf} $R2 == `$\n`
1482 728 mdecorde
          Goto loop
1483 728 mdecorde
        ${EndIf}
1484 728 mdecorde
1485 728 mdecorde
      ;Trim characters (if needed)
1486 728 mdecorde
      IntOp $R1 $R1 + 1
1487 728 mdecorde
      ${If} $R1 < 0
1488 728 mdecorde
        StrCpy $R0 $R0 $R1
1489 728 mdecorde
      ${EndIf}
1490 728 mdecorde
1491 728 mdecorde
    /*After this point:
1492 728 mdecorde
      ------------------------------------------
1493 728 mdecorde
       $R0 = OutVar (output)*/
1494 728 mdecorde
1495 728 mdecorde
      ;Return output to user
1496 728 mdecorde
      Pop $R2
1497 728 mdecorde
      Pop $R1
1498 728 mdecorde
      Exch $R0
1499 728 mdecorde
    FunctionEnd
1500 728 mdecorde
1501 728 mdecorde
  !macroend
1502 728 mdecorde
1503 728 mdecorde
  ;Function Calls for Install and Uninstall
1504 728 mdecorde
1505 728 mdecorde
  !macro FUNCTION_STRING_StrCase_Call ResultVar String Type
1506 728 mdecorde
    !verbose push
1507 728 mdecorde
    !verbose 4
1508 728 mdecorde
    !echo `$ {StrCase} "${ResultVar}" "${String}" "${Type}"`
1509 728 mdecorde
    !verbose pop
1510 728 mdecorde
1511 728 mdecorde
    Push `${String}`
1512 728 mdecorde
    Push `${Type}`
1513 728 mdecorde
    Call StrCase
1514 728 mdecorde
    Pop `${ResultVar}`
1515 728 mdecorde
  !macroend
1516 728 mdecorde
  !macro FUNCTION_STRING_UnStrCase_Call ResultVar String Type
1517 728 mdecorde
    !verbose push
1518 728 mdecorde
    !verbose 4
1519 728 mdecorde
    !echo `$ {UnStrCase} "${ResultVar}" "${String}" "${Type}"`
1520 728 mdecorde
    !verbose pop
1521 728 mdecorde
1522 728 mdecorde
    Push `${String}`
1523 728 mdecorde
    Push `${Type}`
1524 728 mdecorde
    Call un.StrCase
1525 728 mdecorde
    Pop `${ResultVar}`
1526 728 mdecorde
  !macroend
1527 728 mdecorde
1528 728 mdecorde
  !macro FUNCTION_STRING_StrClb_Call ResultVar String Action
1529 728 mdecorde
    !verbose push
1530 728 mdecorde
    !verbose 4
1531 728 mdecorde
    !echo `$ {StrClb} "${ResultVar}" "${String}" "${Action}"`
1532 728 mdecorde
    !verbose pop
1533 728 mdecorde
1534 728 mdecorde
    Push `${String}`
1535 728 mdecorde
    Push `${Action}`
1536 728 mdecorde
    Call StrClb
1537 728 mdecorde
    Pop `${ResultVar}`
1538 728 mdecorde
  !macroend
1539 728 mdecorde
  !macro FUNCTION_STRING_UnStrClb_Call ResultVar String Action
1540 728 mdecorde
    !verbose push
1541 728 mdecorde
    !verbose 4
1542 728 mdecorde
    !echo `$ {UnStrClb} "${ResultVar}" "${String}" "${Action}"`
1543 728 mdecorde
    !verbose pop
1544 728 mdecorde
1545 728 mdecorde
    Push `${String}`
1546 728 mdecorde
    Push `${Action}`
1547 728 mdecorde
    Call un.StrClb
1548 728 mdecorde
    Pop `${ResultVar}`
1549 728 mdecorde
  !macroend
1550 728 mdecorde
1551 728 mdecorde
  !macro FUNCTION_STRING_StrIOToNSIS_Call ResultVar String
1552 728 mdecorde
    !verbose push
1553 728 mdecorde
    !verbose 4
1554 728 mdecorde
    !echo `$ {StrIOToNSIS} "${ResultVar}" "${String}"`
1555 728 mdecorde
    !verbose pop
1556 728 mdecorde
1557 728 mdecorde
    Push `${String}`
1558 728 mdecorde
    Call StrIOToNSIS
1559 728 mdecorde
    Pop `${ResultVar}`
1560 728 mdecorde
  !macroend
1561 728 mdecorde
  !macro FUNCTION_STRING_UnStrIOToNSIS_Call ResultVar String
1562 728 mdecorde
    !verbose push
1563 728 mdecorde
    !verbose 4
1564 728 mdecorde
    !echo `$ {UnStrIOToNSIS} "${ResultVar}" "${String}"`
1565 728 mdecorde
    !verbose pop
1566 728 mdecorde
1567 728 mdecorde
    Push `${String}`
1568 728 mdecorde
    Call un.StrIOToNSIS
1569 728 mdecorde
    Pop `${ResultVar}`
1570 728 mdecorde
  !macroend
1571 728 mdecorde
1572 728 mdecorde
  !macro FUNCTION_STRING_StrLoc_Call ResultVar String StrToSearchFor OffsetDirection
1573 728 mdecorde
    !verbose push
1574 728 mdecorde
    !verbose 4
1575 728 mdecorde
    !echo `$ {StrLoc} "${ResultVar}" "${String}" "${StrToSearchFor}" "${OffsetDirection}"`
1576 728 mdecorde
    !verbose pop
1577 728 mdecorde
1578 728 mdecorde
    Push `${String}`
1579 728 mdecorde
    Push `${StrToSearchFor}`
1580 728 mdecorde
    Push `${OffsetDirection}`
1581 728 mdecorde
    Call StrLoc
1582 728 mdecorde
    Pop `${ResultVar}`
1583 728 mdecorde
  !macroend
1584 728 mdecorde
  !macro FUNCTION_STRING_UnStrLoc_Call ResultVar String StrToSearchFor OffsetDirection
1585 728 mdecorde
    !verbose push
1586 728 mdecorde
    !verbose 4
1587 728 mdecorde
    !echo `$ {UnStrLoc} "${ResultVar}" "${String}" "${StrToSearchFor}" "${OffsetDirection}"`
1588 728 mdecorde
    !verbose pop
1589 728 mdecorde
1590 728 mdecorde
    Push `${String}`
1591 728 mdecorde
    Push `${StrToSearchFor}`
1592 728 mdecorde
    Push `${OffsetDirection}`
1593 728 mdecorde
    Call un.StrLoc
1594 728 mdecorde
    Pop `${ResultVar}`
1595 728 mdecorde
  !macroend
1596 728 mdecorde
1597 728 mdecorde
  !macro FUNCTION_STRING_StrNSISToIO_Call ResultVar String
1598 728 mdecorde
    !verbose push
1599 728 mdecorde
    !verbose 4
1600 728 mdecorde
    !echo `$ {StrNSISToIO} "${ResultVar}" "${String}"`
1601 728 mdecorde
    !verbose pop
1602 728 mdecorde
1603 728 mdecorde
    Push `${String}`
1604 728 mdecorde
    Call StrNSISToIO
1605 728 mdecorde
    Pop `${ResultVar}`
1606 728 mdecorde
  !macroend
1607 728 mdecorde
  !macro FUNCTION_STRING_UnStrNSISToIO_Call ResultVar String
1608 728 mdecorde
    !verbose push
1609 728 mdecorde
    !verbose 4
1610 728 mdecorde
    !echo `$ {UnStrNSISToIO} "${ResultVar}" "${String}"`
1611 728 mdecorde
    !verbose pop
1612 728 mdecorde
1613 728 mdecorde
    Push `${String}`
1614 728 mdecorde
    Call un.StrNSISToIO
1615 728 mdecorde
    Pop `${ResultVar}`
1616 728 mdecorde
  !macroend
1617 728 mdecorde
1618 728 mdecorde
  !macro FUNCTION_STRING_StrRep_Call ResultVar String StringToReplace ReplacementString
1619 728 mdecorde
    !verbose push
1620 728 mdecorde
    !verbose 4
1621 728 mdecorde
    !echo `$ {StrRep} "${ResultVar}" "${String}" "${StringToReplace}" "${ReplacementString}"`
1622 728 mdecorde
    !verbose pop
1623 728 mdecorde
1624 728 mdecorde
    Push `${String}`
1625 728 mdecorde
    Push `${StringToReplace}`
1626 728 mdecorde
    Push `${ReplacementString}`
1627 728 mdecorde
    Call StrRep
1628 728 mdecorde
    Pop `${ResultVar}`
1629 728 mdecorde
  !macroend
1630 728 mdecorde
  !macro FUNCTION_STRING_UnStrRep_Call ResultVar String StringToReplace ReplacementString
1631 728 mdecorde
    !verbose push
1632 728 mdecorde
    !verbose 4
1633 728 mdecorde
    !echo `$ {UnStrRep} "${ResultVar}" "${String}" "${StringToReplace}" "${ReplacementString}"`
1634 728 mdecorde
    !verbose pop
1635 728 mdecorde
1636 728 mdecorde
    Push `${String}`
1637 728 mdecorde
    Push `${StringToReplace}`
1638 728 mdecorde
    Push `${ReplacementString}`
1639 728 mdecorde
    Call un.StrRep
1640 728 mdecorde
    Pop `${ResultVar}`
1641 728 mdecorde
  !macroend
1642 728 mdecorde
1643 728 mdecorde
  !macro FUNCTION_STRING_StrSort_Call ResultVar String CenterStr LeftStr RightStr IncludeCenterStr IncludeLeftStr IncludeRightStr
1644 728 mdecorde
    !verbose push
1645 728 mdecorde
    !verbose 4
1646 728 mdecorde
    !echo `$ {StrSort} "${ResultVar}" "${String}" "${CenterStr}" "${LeftStr}" "${RightStr}" "${IncludeCenterStr}" "${IncludeLeftStr}" "${IncludeRightStr}"`
1647 728 mdecorde
    !verbose pop
1648 728 mdecorde
1649 728 mdecorde
    Push `${String}`
1650 728 mdecorde
    Push `${CenterStr}`
1651 728 mdecorde
    Push `${LeftStr}`
1652 728 mdecorde
    Push `${RightStr}`
1653 728 mdecorde
    Push `${IncludeCenterStr}`
1654 728 mdecorde
    Push `${IncludeLeftStr}`
1655 728 mdecorde
    Push `${IncludeRightStr}`
1656 728 mdecorde
    Call StrSort
1657 728 mdecorde
    Pop `${ResultVar}`
1658 728 mdecorde
  !macroend
1659 728 mdecorde
  !macro FUNCTION_STRING_UnStrSort_Call ResultVar String CenterStr LeftStr RightStr IncludeCenterStr IncludeLeftStr IncludeRightStr
1660 728 mdecorde
    !verbose push
1661 728 mdecorde
    !verbose 4
1662 728 mdecorde
    !echo `$ {UnStrSort} "${ResultVar}" "${String}" "${CenterStr}" "${LeftStr}" "${RightStr}" "${IncludeCenterStr}" "${IncludeLeftStr}" "${IncludeRightStr}"`
1663 728 mdecorde
    !verbose pop
1664 728 mdecorde
1665 728 mdecorde
    Push `${String}`
1666 728 mdecorde
    Push `${CenterStr}`
1667 728 mdecorde
    Push `${LeftStr}`
1668 728 mdecorde
    Push `${RightStr}`
1669 728 mdecorde
    Push `${IncludeCenterStr}`
1670 728 mdecorde
    Push `${IncludeLeftStr}`
1671 728 mdecorde
    Push `${IncludeRightStr}`
1672 728 mdecorde
    Call un.StrSort
1673 728 mdecorde
    Pop `${ResultVar}`
1674 728 mdecorde
  !macroend
1675 728 mdecorde
1676 728 mdecorde
  !macro FUNCTION_STRING_StrStr_Call ResultVar String StrToSearchFor
1677 728 mdecorde
    !verbose push
1678 728 mdecorde
    !verbose 4
1679 728 mdecorde
    !echo `$ {StrStr} "${ResultVar}" "${String}" "${StrToSearchFor}"`
1680 728 mdecorde
    !verbose pop
1681 728 mdecorde
1682 728 mdecorde
    Push `${String}`
1683 728 mdecorde
    Push `${StrToSearchFor}`
1684 728 mdecorde
    Call StrStr
1685 728 mdecorde
    Pop `${ResultVar}`
1686 728 mdecorde
  !macroend
1687 728 mdecorde
  !macro FUNCTION_STRING_UnStrStr_Call ResultVar String StrToSearchFor
1688 728 mdecorde
    !verbose push
1689 728 mdecorde
    !verbose 4
1690 728 mdecorde
    !echo `$ {UnStrStr} "${ResultVar}" "${String}" "${StrToSearchFor}"`
1691 728 mdecorde
    !verbose pop
1692 728 mdecorde
1693 728 mdecorde
    Push `${String}`
1694 728 mdecorde
    Push `${StrToSearchFor}`
1695 728 mdecorde
    Call un.StrStr
1696 728 mdecorde
    Pop `${ResultVar}`
1697 728 mdecorde
  !macroend
1698 728 mdecorde
1699 728 mdecorde
  !macro FUNCTION_STRING_StrStrAdv_Call ResultVar String StrToSearchFor SearchDirection ResultStrDirection DisplayStrToSearch Loops CaseSensitive
1700 728 mdecorde
    !verbose push
1701 728 mdecorde
    !verbose 4
1702 728 mdecorde
    !echo `$ {StrStrAdv} "${ResultVar}" "${String}" "${StrToSearchFor}" "${SearchDirection}" "${ResultStrDirection}" "${DisplayStrToSearch}" "${Loops}" "${CaseSensitive}"`
1703 728 mdecorde
    !verbose pop
1704 728 mdecorde
1705 728 mdecorde
    Push `${String}`
1706 728 mdecorde
    Push `${StrToSearchFor}`
1707 728 mdecorde
    Push `${SearchDirection}`
1708 728 mdecorde
    Push `${ResultStrDirection}`
1709 728 mdecorde
    Push `${DisplayStrToSearch}`
1710 728 mdecorde
    Push `${Loops}`
1711 728 mdecorde
    Push `${CaseSensitive}`
1712 728 mdecorde
    Call StrStrAdv
1713 728 mdecorde
    Pop `${ResultVar}`
1714 728 mdecorde
  !macroend
1715 728 mdecorde
  !macro FUNCTION_STRING_UnStrStrAdv_Call ResultVar String StrToSearchFor SearchDirection ResultStrDirection DisplayStrToSearch Loops CaseSensitive
1716 728 mdecorde
    !verbose push
1717 728 mdecorde
    !verbose 4
1718 728 mdecorde
    !echo `$ {UnStrStrAdv} "${ResultVar}" "${String}" "${StrToSearchFor}" "${SearchDirection}" "${ResultStrDirection}" "${DisplayStrToSearch}" "${Loops}" "${CaseSensitive}"`
1719 728 mdecorde
    !verbose pop
1720 728 mdecorde
1721 728 mdecorde
    Push `${String}`
1722 728 mdecorde
    Push `${StrToSearchFor}`
1723 728 mdecorde
    Push `${SearchDirection}`
1724 728 mdecorde
    Push `${ResultStrDirection}`
1725 728 mdecorde
    Push `${DisplayStrToSearch}`
1726 728 mdecorde
    Push `${Loops}`
1727 728 mdecorde
    Push `${CaseSensitive}`
1728 728 mdecorde
    Call un.StrStrAdv
1729 728 mdecorde
    Pop `${ResultVar}`
1730 728 mdecorde
  !macroend
1731 728 mdecorde
1732 728 mdecorde
  !macro FUNCTION_STRING_StrTok_Call ResultVar String Separators ResultPart SkipEmptyParts
1733 728 mdecorde
    !verbose push
1734 728 mdecorde
    !verbose 4
1735 728 mdecorde
    !echo `$ {StrTok} "${ResultVar}" "${String}" "${Separators}" "${ResultPart}" "${SkipEmptyParts}"`
1736 728 mdecorde
    !verbose pop
1737 728 mdecorde
1738 728 mdecorde
    Push `${String}`
1739 728 mdecorde
    Push `${Separators}`
1740 728 mdecorde
    Push `${ResultPart}`
1741 728 mdecorde
    Push `${SkipEmptyParts}`
1742 728 mdecorde
    Call StrTok
1743 728 mdecorde
    Pop `${ResultVar}`
1744 728 mdecorde
  !macroend
1745 728 mdecorde
  !macro FUNCTION_STRING_UnStrTok_Call ResultVar String Separators ResultPart SkipEmptyParts
1746 728 mdecorde
    !verbose push
1747 728 mdecorde
    !verbose 4
1748 728 mdecorde
    !echo `$ {UnStrTok} "${ResultVar}" "${String}" "${Separators}" "${ResultPart}" "${SkipEmptyParts}"`
1749 728 mdecorde
    !verbose pop
1750 728 mdecorde
1751 728 mdecorde
    Push `${String}`
1752 728 mdecorde
    Push `${Separators}`
1753 728 mdecorde
    Push `${ResultPart}`
1754 728 mdecorde
    Push `${SkipEmptyParts}`
1755 728 mdecorde
    Call un.StrTok
1756 728 mdecorde
    Pop `${ResultVar}`
1757 728 mdecorde
  !macroend
1758 728 mdecorde
1759 728 mdecorde
  !macro FUNCTION_STRING_StrTrimNewLines_Call ResultVar String
1760 728 mdecorde
    !verbose push
1761 728 mdecorde
    !verbose 4
1762 728 mdecorde
    !echo `$ {StrTrimNewLines} "${ResultVar}" "${String}"`
1763 728 mdecorde
    !verbose pop
1764 728 mdecorde
1765 728 mdecorde
    Push `${String}`
1766 728 mdecorde
    Call StrTrimNewLines
1767 728 mdecorde
    Pop `${ResultVar}`
1768 728 mdecorde
  !macroend
1769 728 mdecorde
  !macro FUNCTION_STRING_UnStrTrimNewLines_Call ResultVar String
1770 728 mdecorde
    !verbose push
1771 728 mdecorde
    !verbose 4
1772 728 mdecorde
    !echo `$ {UnStrTrimNewLines} "${ResultVar}" "${String}"`
1773 728 mdecorde
    !verbose pop
1774 728 mdecorde
1775 728 mdecorde
    Push `${String}`
1776 728 mdecorde
    Call un.StrTrimNewLines
1777 728 mdecorde
    Pop `${ResultVar}`
1778 728 mdecorde
  !macroend
1779 728 mdecorde
1780 728 mdecorde
!endif
1781 728 mdecorde
!verbose 3
1782 728 mdecorde
!define STRFUNC_VERBOSITY ${_STRFUNC_VERBOSITY}
1783 728 mdecorde
!undef _STRFUNC_VERBOSITY
1784 728 mdecorde
!verbose pop