Statistiques
| Révision :

root / tmp / org.txm.setups / nsis-2.5 / Include / StrFunc.nsh @ 3101

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

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