Statistiques
| Révision :

root / tmp / org.txm.setups / nsis / Include / TextFunc.nsh @ 2021

Historique | Voir | Annoter | Télécharger (23,84 ko)

1 728 mdecorde
/*
2 728 mdecorde
_____________________________________________________________________________
3 728 mdecorde
4 728 mdecorde
                       Text Functions Header v2.4
5 728 mdecorde
_____________________________________________________________________________
6 728 mdecorde
7 728 mdecorde
 2006 Shengalts Aleksander aka Instructor (Shengalts@mail.ru)
8 728 mdecorde
9 728 mdecorde
 See documentation for more information about the following functions.
10 728 mdecorde
11 728 mdecorde
 Usage in script:
12 728 mdecorde
 1. !include "TextFunc.nsh"
13 728 mdecorde
 2. [Section|Function]
14 728 mdecorde
      ${TextFunction} "File" "..."  $var
15 728 mdecorde
    [SectionEnd|FunctionEnd]
16 728 mdecorde
17 728 mdecorde
18 728 mdecorde
 TextFunction=[LineFind|LineRead|FileReadFromEnd|LineSum|FileJoin|
19 728 mdecorde
               TextCompare|TextCompareS|ConfigRead|ConfigReadS|
20 728 mdecorde
               ConfigWrite|ConfigWriteS|FileRecode|TrimNewLines]
21 728 mdecorde
22 728 mdecorde
_____________________________________________________________________________
23 728 mdecorde
24 728 mdecorde
                       Thanks to:
25 728 mdecorde
_____________________________________________________________________________
26 728 mdecorde
27 728 mdecorde
LineRead
28 728 mdecorde
	Afrow UK (Based on his idea of Function "ReadFileLine")
29 728 mdecorde
LineSum
30 728 mdecorde
	Afrow UK (Based on his idea of Function "LineCount")
31 728 mdecorde
FileJoin
32 728 mdecorde
	Afrow UK (Based on his idea of Function "JoinFiles")
33 728 mdecorde
ConfigRead
34 728 mdecorde
	vbgunz (His idea)
35 728 mdecorde
ConfigWrite
36 728 mdecorde
	vbgunz (His idea)
37 728 mdecorde
TrimNewLines
38 728 mdecorde
	sunjammer (Based on his Function "TrimNewLines")
39 728 mdecorde
*/
40 728 mdecorde
41 728 mdecorde
42 728 mdecorde
;_____________________________________________________________________________
43 728 mdecorde
;
44 728 mdecorde
;                                   Macros
45 728 mdecorde
;_____________________________________________________________________________
46 728 mdecorde
;
47 728 mdecorde
; Change log window verbosity (default: 3=no script)
48 728 mdecorde
;
49 728 mdecorde
; Example:
50 728 mdecorde
; !include "TextFunc.nsh"
51 728 mdecorde
; !insertmacro LineFind
52 728 mdecorde
; ${TEXTFUNC_VERBOSE} 4   # all verbosity
53 728 mdecorde
; !insertmacro LineSum
54 728 mdecorde
; ${TEXTFUNC_VERBOSE} 3   # no script
55 728 mdecorde
56 728 mdecorde
!ifndef TEXTFUNC_INCLUDED
57 728 mdecorde
!define TEXTFUNC_INCLUDED
58 728 mdecorde
59 728 mdecorde
!include FileFunc.nsh
60 728 mdecorde
!include Util.nsh
61 728 mdecorde
62 728 mdecorde
!verbose push
63 728 mdecorde
!verbose 3
64 728 mdecorde
!ifndef _TEXTFUNC_VERBOSE
65 728 mdecorde
	!define _TEXTFUNC_VERBOSE 3
66 728 mdecorde
!endif
67 728 mdecorde
!verbose ${_TEXTFUNC_VERBOSE}
68 728 mdecorde
!define TEXTFUNC_VERBOSE `!insertmacro TEXTFUNC_VERBOSE`
69 728 mdecorde
!verbose pop
70 728 mdecorde
71 728 mdecorde
!macro TEXTFUNC_VERBOSE _VERBOSE
72 728 mdecorde
	!verbose push
73 728 mdecorde
	!verbose 3
74 728 mdecorde
	!undef _TEXTFUNC_VERBOSE
75 728 mdecorde
	!define _TEXTFUNC_VERBOSE ${_VERBOSE}
76 728 mdecorde
	!verbose pop
77 728 mdecorde
!macroend
78 728 mdecorde
79 728 mdecorde
!macro LineFindCall _INPUT _OUTPUT _RANGE _FUNC
80 728 mdecorde
	!verbose push
81 728 mdecorde
	!verbose ${_TEXTFUNC_VERBOSE}
82 728 mdecorde
	Push $0
83 728 mdecorde
	Push `${_INPUT}`
84 728 mdecorde
	Push `${_OUTPUT}`
85 728 mdecorde
	Push `${_RANGE}`
86 728 mdecorde
	GetFunctionAddress $0 `${_FUNC}`
87 728 mdecorde
	Push `$0`
88 728 mdecorde
	${CallArtificialFunction} LineFind_
89 728 mdecorde
	Pop $0
90 728 mdecorde
	!verbose pop
91 728 mdecorde
!macroend
92 728 mdecorde
93 728 mdecorde
!macro LineReadCall _FILE _NUMBER _RESULT
94 728 mdecorde
	!verbose push
95 728 mdecorde
	!verbose ${_TEXTFUNC_VERBOSE}
96 728 mdecorde
	Push `${_FILE}`
97 728 mdecorde
	Push `${_NUMBER}`
98 728 mdecorde
	${CallArtificialFunction} LineRead_
99 728 mdecorde
	Pop ${_RESULT}
100 728 mdecorde
	!verbose pop
101 728 mdecorde
!macroend
102 728 mdecorde
103 728 mdecorde
!macro FileReadFromEndCall _FILE _FUNC
104 728 mdecorde
	!verbose push
105 728 mdecorde
	!verbose ${_TEXTFUNC_VERBOSE}
106 728 mdecorde
	Push $0
107 728 mdecorde
	Push `${_FILE}`
108 728 mdecorde
	GetFunctionAddress $0 `${_FUNC}`
109 728 mdecorde
	Push `$0`
110 728 mdecorde
	${CallArtificialFunction} FileReadFromEnd_
111 728 mdecorde
	Pop $0
112 728 mdecorde
	!verbose pop
113 728 mdecorde
!macroend
114 728 mdecorde
115 728 mdecorde
!macro LineSumCall _FILE _RESULT
116 728 mdecorde
	!verbose push
117 728 mdecorde
	!verbose ${_TEXTFUNC_VERBOSE}
118 728 mdecorde
	Push `${_FILE}`
119 728 mdecorde
	${CallArtificialFunction} LineSum_
120 728 mdecorde
	Pop ${_RESULT}
121 728 mdecorde
	!verbose pop
122 728 mdecorde
!macroend
123 728 mdecorde
124 728 mdecorde
!macro FileJoinCall _FILE1 _FILE2 _FILE3
125 728 mdecorde
	!verbose push
126 728 mdecorde
	!verbose ${_TEXTFUNC_VERBOSE}
127 728 mdecorde
	Push `${_FILE1}`
128 728 mdecorde
	Push `${_FILE2}`
129 728 mdecorde
	Push `${_FILE3}`
130 728 mdecorde
	${CallArtificialFunction} FileJoin_
131 728 mdecorde
	!verbose pop
132 728 mdecorde
!macroend
133 728 mdecorde
134 728 mdecorde
!macro TextCompareCall _FILE1 _FILE2 _OPTION _FUNC
135 728 mdecorde
	!verbose push
136 728 mdecorde
	!verbose ${_TEXTFUNC_VERBOSE}
137 728 mdecorde
	Push $0
138 728 mdecorde
	Push `${_FILE1}`
139 728 mdecorde
	Push `${_FILE2}`
140 728 mdecorde
	Push `${_OPTION}`
141 728 mdecorde
	GetFunctionAddress $0 `${_FUNC}`
142 728 mdecorde
	Push `$0`
143 728 mdecorde
	${CallArtificialFunction} TextCompare_
144 728 mdecorde
	Pop $0
145 728 mdecorde
	!verbose pop
146 728 mdecorde
!macroend
147 728 mdecorde
148 728 mdecorde
!macro TextCompareSCall _FILE1 _FILE2 _OPTION _FUNC
149 728 mdecorde
	!verbose push
150 728 mdecorde
	!verbose ${_TEXTFUNC_VERBOSE}
151 728 mdecorde
	Push $0
152 728 mdecorde
	Push `${_FILE1}`
153 728 mdecorde
	Push `${_FILE2}`
154 728 mdecorde
	Push `${_OPTION}`
155 728 mdecorde
	GetFunctionAddress $0 `${_FUNC}`
156 728 mdecorde
	Push `$0`
157 728 mdecorde
	${CallArtificialFunction} TextCompareS_
158 728 mdecorde
	Pop $0
159 728 mdecorde
	!verbose pop
160 728 mdecorde
!macroend
161 728 mdecorde
162 728 mdecorde
!macro ConfigReadCall _FILE _ENTRY _RESULT
163 728 mdecorde
	!verbose push
164 728 mdecorde
	!verbose ${_TEXTFUNC_VERBOSE}
165 728 mdecorde
	Push `${_FILE}`
166 728 mdecorde
	Push `${_ENTRY}`
167 728 mdecorde
	${CallArtificialFunction} ConfigRead_
168 728 mdecorde
	Pop ${_RESULT}
169 728 mdecorde
	!verbose pop
170 728 mdecorde
!macroend
171 728 mdecorde
172 728 mdecorde
!macro ConfigReadSCall _FILE _ENTRY _RESULT
173 728 mdecorde
	!verbose push
174 728 mdecorde
	!verbose ${_TEXTFUNC_VERBOSE}
175 728 mdecorde
	Push `${_FILE}`
176 728 mdecorde
	Push `${_ENTRY}`
177 728 mdecorde
	${CallArtificialFunction} ConfigReadS_
178 728 mdecorde
	Pop ${_RESULT}
179 728 mdecorde
	!verbose pop
180 728 mdecorde
!macroend
181 728 mdecorde
182 728 mdecorde
!macro ConfigWriteCall _FILE _ENTRY _VALUE _RESULT
183 728 mdecorde
	!verbose push
184 728 mdecorde
	!verbose ${_TEXTFUNC_VERBOSE}
185 728 mdecorde
	Push `${_FILE}`
186 728 mdecorde
	Push `${_ENTRY}`
187 728 mdecorde
	Push `${_VALUE}`
188 728 mdecorde
	${CallArtificialFunction} ConfigWrite_
189 728 mdecorde
	Pop ${_RESULT}
190 728 mdecorde
	!verbose pop
191 728 mdecorde
!macroend
192 728 mdecorde
193 728 mdecorde
!macro ConfigWriteSCall _FILE _ENTRY _VALUE _RESULT
194 728 mdecorde
	!verbose push
195 728 mdecorde
	!verbose ${_TEXTFUNC_VERBOSE}
196 728 mdecorde
	Push `${_FILE}`
197 728 mdecorde
	Push `${_ENTRY}`
198 728 mdecorde
	Push `${_VALUE}`
199 728 mdecorde
	${CallArtificialFunction} ConfigWriteS_
200 728 mdecorde
	Pop ${_RESULT}
201 728 mdecorde
	!verbose pop
202 728 mdecorde
!macroend
203 728 mdecorde
204 728 mdecorde
!macro FileRecodeCall _FILE _FORMAT
205 728 mdecorde
	!verbose push
206 728 mdecorde
	!verbose ${_TEXTFUNC_VERBOSE}
207 728 mdecorde
	Push `${_FILE}`
208 728 mdecorde
	Push `${_FORMAT}`
209 728 mdecorde
	${CallArtificialFunction} FileRecode_
210 728 mdecorde
	!verbose pop
211 728 mdecorde
!macroend
212 728 mdecorde
213 728 mdecorde
!macro TrimNewLinesCall _FILE _RESULT
214 728 mdecorde
	!verbose push
215 728 mdecorde
	!verbose ${_TEXTFUNC_VERBOSE}
216 728 mdecorde
	Push `${_FILE}`
217 728 mdecorde
	${CallArtificialFunction} TrimNewLines_
218 728 mdecorde
	Pop ${_RESULT}
219 728 mdecorde
	!verbose pop
220 728 mdecorde
!macroend
221 728 mdecorde
222 728 mdecorde
!macro _TextFunc_TempFileForFile _FILE _RESULT
223 728 mdecorde
	# XXX replace with GetParent
224 728 mdecorde
	Push `${_FILE}`
225 728 mdecorde
	Exch $0
226 728 mdecorde
	Push $1
227 728 mdecorde
	Push $2
228 728 mdecorde
229 728 mdecorde
	StrCpy $2 $0 1 -1
230 728 mdecorde
	StrCmp $2 '\' 0 +3
231 728 mdecorde
	StrCpy $0 $0 -1
232 728 mdecorde
	goto -3
233 728 mdecorde
234 728 mdecorde
	StrCpy $1 0
235 728 mdecorde
	IntOp $1 $1 - 1
236 728 mdecorde
	StrCpy $2 $0 1 $1
237 728 mdecorde
	StrCmp $2 '\' +2
238 728 mdecorde
	StrCmp $2 '' 0 -3
239 728 mdecorde
	StrCpy $0 $0 $1
240 728 mdecorde
241 728 mdecorde
	Pop $2
242 728 mdecorde
	Pop $1
243 728 mdecorde
	Exch $0
244 728 mdecorde
	Pop ${_RESULT}
245 728 mdecorde
	# XXX
246 728 mdecorde
	StrCmp ${_RESULT} "" 0 +2
247 728 mdecorde
		StrCpy ${_RESULT} $EXEDIR
248 728 mdecorde
	GetTempFileName ${_RESULT} ${_RESULT}
249 728 mdecorde
	StrCmp ${_RESULT} "" 0 +2
250 728 mdecorde
		GetTempFileName ${_RESULT}
251 728 mdecorde
	ClearErrors
252 728 mdecorde
!macroend
253 728 mdecorde
254 728 mdecorde
!define LineFind `!insertmacro LineFindCall`
255 728 mdecorde
!define un.LineFind `!insertmacro LineFindCall`
256 728 mdecorde
257 728 mdecorde
!macro LineFind
258 728 mdecorde
!macroend
259 728 mdecorde
260 728 mdecorde
!macro un.LineFind
261 728 mdecorde
!macroend
262 728 mdecorde
263 728 mdecorde
!macro LineFind_
264 728 mdecorde
	!verbose push
265 728 mdecorde
	!verbose ${_TEXTFUNC_VERBOSE}
266 728 mdecorde
267 728 mdecorde
	Exch $3
268 728 mdecorde
	Exch
269 728 mdecorde
	Exch $2
270 728 mdecorde
	Exch
271 728 mdecorde
	Exch 2
272 728 mdecorde
	Exch $1
273 728 mdecorde
	Exch 2
274 728 mdecorde
	Exch 3
275 728 mdecorde
	Exch $0
276 728 mdecorde
	Exch 3
277 728 mdecorde
	Push $4
278 728 mdecorde
	Push $5
279 728 mdecorde
	Push $6
280 728 mdecorde
	Push $7
281 728 mdecorde
	Push $8
282 728 mdecorde
	Push $9
283 728 mdecorde
	Push $R4
284 728 mdecorde
	Push $R5
285 728 mdecorde
	Push $R6
286 728 mdecorde
	Push $R7
287 728 mdecorde
	Push $R8
288 728 mdecorde
	Push $R9
289 728 mdecorde
	ClearErrors
290 728 mdecorde
291 728 mdecorde
	IfFileExists '$0' 0 TextFunc_LineFind_error
292 728 mdecorde
	StrCmp $1 '/NUL' TextFunc_LineFind_begin
293 728 mdecorde
	StrCpy $8 0
294 728 mdecorde
	IntOp $8 $8 - 1
295 728 mdecorde
	StrCpy $9 $1 1 $8
296 728 mdecorde
	StrCmp $9 \ +2
297 728 mdecorde
	StrCmp $9 '' +3 -3
298 728 mdecorde
	StrCpy $9 $1 $8
299 728 mdecorde
	IfFileExists '$9\*.*' 0 TextFunc_LineFind_error
300 728 mdecorde
301 728 mdecorde
	TextFunc_LineFind_begin:
302 728 mdecorde
	StrCpy $4 1
303 728 mdecorde
	StrCpy $5 -1
304 728 mdecorde
	StrCpy $6 0
305 728 mdecorde
	StrCpy $7 0
306 728 mdecorde
	StrCpy $R4 ''
307 728 mdecorde
	StrCpy $R6 ''
308 728 mdecorde
	StrCpy $R7 ''
309 728 mdecorde
	StrCpy $R8 0
310 728 mdecorde
311 728 mdecorde
	StrCpy $8 $2 1
312 728 mdecorde
	StrCmp $8 '{' 0 TextFunc_LineFind_delspaces
313 728 mdecorde
	StrCpy $2 $2 '' 1
314 728 mdecorde
	StrCpy $8 $2 1 -1
315 728 mdecorde
	StrCmp $8 '}' 0 TextFunc_LineFind_delspaces
316 728 mdecorde
	StrCpy $2 $2 -1
317 728 mdecorde
	StrCpy $R6 TextFunc_LineFind_cut
318 728 mdecorde
319 728 mdecorde
	TextFunc_LineFind_delspaces:
320 728 mdecorde
	StrCpy $8 $2 1
321 728 mdecorde
	StrCmp $8 ' ' 0 +3
322 728 mdecorde
	StrCpy $2 $2 '' 1
323 728 mdecorde
	goto -3
324 728 mdecorde
	StrCmp $2$7 '0' TextFunc_LineFind_file
325 728 mdecorde
	StrCpy $4 ''
326 728 mdecorde
	StrCpy $5 ''
327 728 mdecorde
	StrCmp $2 '' TextFunc_LineFind_writechk
328 728 mdecorde
329 728 mdecorde
	TextFunc_LineFind_range:
330 728 mdecorde
	StrCpy $8 0
331 728 mdecorde
	StrCpy $9 $2 1 $8
332 728 mdecorde
	StrCmp $9 '' +5
333 728 mdecorde
	StrCmp $9 ' ' +4
334 728 mdecorde
	StrCmp $9 ':' +3
335 728 mdecorde
	IntOp $8 $8 + 1
336 728 mdecorde
	goto -5
337 728 mdecorde
	StrCpy $5 $2 $8
338 728 mdecorde
	IntOp $5 $5 + 0
339 728 mdecorde
	IntOp $8 $8 + 1
340 728 mdecorde
	StrCpy $2 $2 '' $8
341 728 mdecorde
	StrCmp $4 '' 0 +2
342 728 mdecorde
	StrCpy $4 $5
343 728 mdecorde
	StrCmp $9 ':' TextFunc_LineFind_range
344 728 mdecorde
345 728 mdecorde
	IntCmp $4 0 0 +2
346 728 mdecorde
	IntCmp $5 -1 TextFunc_LineFind_goto 0 TextFunc_LineFind_growthcmp
347 728 mdecorde
	StrCmp $R7 '' 0 TextFunc_LineFind_minus2plus
348 728 mdecorde
	StrCpy $R7 0
349 728 mdecorde
	FileOpen $8 $0 r
350 728 mdecorde
	FileRead $8 $9
351 728 mdecorde
	IfErrors +3
352 728 mdecorde
	IntOp $R7 $R7 + 1
353 728 mdecorde
	Goto -3
354 728 mdecorde
	FileClose $8
355 728 mdecorde
356 728 mdecorde
	TextFunc_LineFind_minus2plus:
357 728 mdecorde
	IntCmp $4 0 +5 0 +5
358 728 mdecorde
	IntOp $4 $R7 + $4
359 728 mdecorde
	IntOp $4 $4 + 1
360 728 mdecorde
	IntCmp $4 0 +2 0 +2
361 728 mdecorde
	StrCpy $4 0
362 728 mdecorde
	IntCmp $5 -1 TextFunc_LineFind_goto 0 TextFunc_LineFind_growthcmp
363 728 mdecorde
	IntOp $5 $R7 + $5
364 728 mdecorde
	IntOp $5 $5 + 1
365 728 mdecorde
	TextFunc_LineFind_growthcmp:
366 728 mdecorde
	IntCmp $4 $5 TextFunc_LineFind_goto TextFunc_LineFind_goto
367 728 mdecorde
	StrCpy $5 $4
368 728 mdecorde
	TextFunc_LineFind_goto:
369 728 mdecorde
	goto $7
370 728 mdecorde
371 728 mdecorde
	TextFunc_LineFind_file:
372 728 mdecorde
	StrCmp $1 '/NUL' TextFunc_LineFind_notemp
373 728 mdecorde
	!insertmacro _TextFunc_TempFileForFile $1 $R4
374 728 mdecorde
	Push $R4
375 728 mdecorde
	FileOpen $R4 $R4 w
376 728 mdecorde
	TextFunc_LineFind_notemp:
377 728 mdecorde
	FileOpen $R5 $0 r
378 728 mdecorde
	IfErrors TextFunc_LineFind_preerror
379 728 mdecorde
380 728 mdecorde
	TextFunc_LineFind_loop:
381 728 mdecorde
	IntOp $R8 $R8 + 1
382 728 mdecorde
	FileRead $R5 $R9
383 728 mdecorde
	IfErrors TextFunc_LineFind_handleclose
384 728 mdecorde
385 728 mdecorde
	TextFunc_LineFind_cmp:
386 728 mdecorde
	StrCmp $2$4$5 '' TextFunc_LineFind_writechk
387 728 mdecorde
	IntCmp $4 $R8 TextFunc_LineFind_call 0 TextFunc_LineFind_writechk
388 728 mdecorde
	StrCmp $5 -1 TextFunc_LineFind_call
389 728 mdecorde
	IntCmp $5 $R8 TextFunc_LineFind_call 0 TextFunc_LineFind_call
390 728 mdecorde
391 728 mdecorde
	GetLabelAddress $7 TextFunc_LineFind_cmp
392 728 mdecorde
	goto TextFunc_LineFind_delspaces
393 728 mdecorde
394 728 mdecorde
	TextFunc_LineFind_call:
395 728 mdecorde
	StrCpy $7 $R9
396 728 mdecorde
	Push $0
397 728 mdecorde
	Push $1
398 728 mdecorde
	Push $2
399 728 mdecorde
	Push $3
400 728 mdecorde
	Push $4
401 728 mdecorde
	Push $5
402 728 mdecorde
	Push $6
403 728 mdecorde
	Push $7
404 728 mdecorde
	Push $R4
405 728 mdecorde
	Push $R5
406 728 mdecorde
	Push $R6
407 728 mdecorde
	Push $R7
408 728 mdecorde
	Push $R8
409 728 mdecorde
	StrCpy $R6 '$4:$5'
410 728 mdecorde
	StrCmp $R7 '' +3
411 728 mdecorde
	IntOp $R7 $R8 - $R7
412 728 mdecorde
	IntOp $R7 $R7 - 1
413 728 mdecorde
	Call $3
414 728 mdecorde
	Pop $9
415 728 mdecorde
	Pop $R8
416 728 mdecorde
	Pop $R7
417 728 mdecorde
	Pop $R6
418 728 mdecorde
	Pop $R5
419 728 mdecorde
	Pop $R4
420 728 mdecorde
	Pop $7
421 728 mdecorde
	Pop $6
422 728 mdecorde
	Pop $5
423 728 mdecorde
	Pop $4
424 728 mdecorde
	Pop $3
425 728 mdecorde
	Pop $2
426 728 mdecorde
	Pop $1
427 728 mdecorde
	Pop $0
428 728 mdecorde
	IfErrors TextFunc_LineFind_preerror
429 728 mdecorde
	StrCmp $9 'StopLineFind' 0 +3
430 728 mdecorde
	IntOp $6 $6 + 1
431 728 mdecorde
	goto TextFunc_LineFind_handleclose
432 728 mdecorde
	StrCmp $1 '/NUL' TextFunc_LineFind_loop
433 728 mdecorde
	StrCmp $9 'SkipWrite' 0 +3
434 728 mdecorde
	IntOp $6 $6 + 1
435 728 mdecorde
	goto TextFunc_LineFind_loop
436 728 mdecorde
	StrCmp $7 $R9 TextFunc_LineFind_write
437 728 mdecorde
	IntOp $6 $6 + 1
438 728 mdecorde
	goto TextFunc_LineFind_write
439 728 mdecorde
440 728 mdecorde
	TextFunc_LineFind_writechk:
441 728 mdecorde
	StrCmp $1 '/NUL' TextFunc_LineFind_loop
442 728 mdecorde
	StrCmp $R6 TextFunc_LineFind_cut 0 TextFunc_LineFind_write
443 728 mdecorde
	IntOp $6 $6 + 1
444 728 mdecorde
	goto TextFunc_LineFind_loop
445 728 mdecorde
446 728 mdecorde
	TextFunc_LineFind_write:
447 728 mdecorde
	FileWrite $R4 $R9
448 728 mdecorde
	goto TextFunc_LineFind_loop
449 728 mdecorde
450 728 mdecorde
	TextFunc_LineFind_preerror:
451 728 mdecorde
	SetErrors
452 728 mdecorde
453 728 mdecorde
	TextFunc_LineFind_handleclose:
454 728 mdecorde
	StrCmp $1 '/NUL' +3
455 728 mdecorde
	FileClose $R4
456 728 mdecorde
	Pop $R4
457 728 mdecorde
	FileClose $R5
458 728 mdecorde
	IfErrors TextFunc_LineFind_error
459 728 mdecorde
460 728 mdecorde
	StrCmp $1 '/NUL' TextFunc_LineFind_end
461 728 mdecorde
	StrCmp $1 '' 0 +2
462 728 mdecorde
	StrCpy $1 $0
463 728 mdecorde
	StrCmp $6 0 0 TextFunc_LineFind_rename
464 728 mdecorde
	FileOpen $7 $0 r
465 728 mdecorde
	FileSeek $7 0 END $8
466 728 mdecorde
	FileClose $7
467 728 mdecorde
	FileOpen $7 $R4 r
468 728 mdecorde
	FileSeek $7 0 END $9
469 728 mdecorde
	FileClose $7
470 728 mdecorde
	IntCmp $8 $9 0 TextFunc_LineFind_rename
471 728 mdecorde
	Delete $R4
472 728 mdecorde
	StrCmp $1 $0 TextFunc_LineFind_end
473 728 mdecorde
	CopyFiles /SILENT $0 $1
474 728 mdecorde
	goto TextFunc_LineFind_end
475 728 mdecorde
476 728 mdecorde
	TextFunc_LineFind_rename:
477 728 mdecorde
	Delete '$EXEDIR\$1'
478 728 mdecorde
	Rename $R4 '$EXEDIR\$1'
479 728 mdecorde
	IfErrors 0 TextFunc_LineFind_end
480 728 mdecorde
	Delete $1
481 728 mdecorde
	Rename $R4 $1
482 728 mdecorde
	IfErrors 0 TextFunc_LineFind_end
483 728 mdecorde
484 728 mdecorde
	TextFunc_LineFind_error:
485 728 mdecorde
	SetErrors
486 728 mdecorde
487 728 mdecorde
	TextFunc_LineFind_end:
488 728 mdecorde
	Pop $R9
489 728 mdecorde
	Pop $R8
490 728 mdecorde
	Pop $R7
491 728 mdecorde
	Pop $R6
492 728 mdecorde
	Pop $R5
493 728 mdecorde
	Pop $R4
494 728 mdecorde
	Pop $9
495 728 mdecorde
	Pop $8
496 728 mdecorde
	Pop $7
497 728 mdecorde
	Pop $6
498 728 mdecorde
	Pop $5
499 728 mdecorde
	Pop $4
500 728 mdecorde
	Pop $3
501 728 mdecorde
	Pop $2
502 728 mdecorde
	Pop $1
503 728 mdecorde
	Pop $0
504 728 mdecorde
505 728 mdecorde
	!verbose pop
506 728 mdecorde
!macroend
507 728 mdecorde
508 728 mdecorde
!define LineRead `!insertmacro LineReadCall`
509 728 mdecorde
!define un.LineRead `!insertmacro LineReadCall`
510 728 mdecorde
511 728 mdecorde
!macro LineRead
512 728 mdecorde
!macroend
513 728 mdecorde
514 728 mdecorde
!macro un.LineRead
515 728 mdecorde
!macroend
516 728 mdecorde
517 728 mdecorde
!macro LineRead_
518 728 mdecorde
	!verbose push
519 728 mdecorde
	!verbose ${_TEXTFUNC_VERBOSE}
520 728 mdecorde
521 728 mdecorde
	Exch $1
522 728 mdecorde
	Exch
523 728 mdecorde
	Exch $0
524 728 mdecorde
	Exch
525 728 mdecorde
	Push $2
526 728 mdecorde
	Push $3
527 728 mdecorde
	Push $4
528 728 mdecorde
	ClearErrors
529 728 mdecorde
530 728 mdecorde
	IfFileExists $0 0 TextFunc_LineRead_error
531 728 mdecorde
	IntOp $1 $1 + 0
532 728 mdecorde
	IntCmp $1 0 TextFunc_LineRead_error 0 TextFunc_LineRead_plus
533 728 mdecorde
	StrCpy $4 0
534 728 mdecorde
	FileOpen $2 $0 r
535 728 mdecorde
	IfErrors TextFunc_LineRead_error
536 728 mdecorde
	FileRead $2 $3
537 728 mdecorde
	IfErrors +3
538 728 mdecorde
	IntOp $4 $4 + 1
539 728 mdecorde
	Goto -3
540 728 mdecorde
	FileClose $2
541 728 mdecorde
	IntOp $1 $4 + $1
542 728 mdecorde
	IntOp $1 $1 + 1
543 728 mdecorde
	IntCmp $1 0 TextFunc_LineRead_error TextFunc_LineRead_error
544 728 mdecorde
545 728 mdecorde
	TextFunc_LineRead_plus:
546 728 mdecorde
	FileOpen $2 $0 r
547 728 mdecorde
	IfErrors TextFunc_LineRead_error
548 728 mdecorde
	StrCpy $3 0
549 728 mdecorde
	IntOp $3 $3 + 1
550 728 mdecorde
	FileRead $2 $0
551 728 mdecorde
	IfErrors +4
552 728 mdecorde
	StrCmp $3 $1 0 -3
553 728 mdecorde
	FileClose $2
554 728 mdecorde
	goto TextFunc_LineRead_end
555 728 mdecorde
	FileClose $2
556 728 mdecorde
557 728 mdecorde
	TextFunc_LineRead_error:
558 728 mdecorde
	SetErrors
559 728 mdecorde
	StrCpy $0 ''
560 728 mdecorde
561 728 mdecorde
	TextFunc_LineRead_end:
562 728 mdecorde
	Pop $4
563 728 mdecorde
	Pop $3
564 728 mdecorde
	Pop $2
565 728 mdecorde
	Pop $1
566 728 mdecorde
	Exch $0
567 728 mdecorde
568 728 mdecorde
	!verbose pop
569 728 mdecorde
!macroend
570 728 mdecorde
571 728 mdecorde
!define FileReadFromEnd `!insertmacro FileReadFromEndCall`
572 728 mdecorde
!define un.FileReadFromEnd `!insertmacro FileReadFromEndCall`
573 728 mdecorde
574 728 mdecorde
!macro FileReadFromEnd
575 728 mdecorde
!macroend
576 728 mdecorde
577 728 mdecorde
!macro un.FileReadFromEnd
578 728 mdecorde
!macroend
579 728 mdecorde
580 728 mdecorde
!macro FileReadFromEnd_
581 728 mdecorde
	!verbose push
582 728 mdecorde
	!verbose ${_TEXTFUNC_VERBOSE}
583 728 mdecorde
584 728 mdecorde
	Exch $1
585 728 mdecorde
	Exch
586 728 mdecorde
	Exch $0
587 728 mdecorde
	Exch
588 728 mdecorde
	Push $7
589 728 mdecorde
	Push $8
590 728 mdecorde
	Push $9
591 728 mdecorde
	ClearErrors
592 728 mdecorde
593 728 mdecorde
	StrCpy $7 -1
594 728 mdecorde
	StrCpy $8 0
595 728 mdecorde
	IfFileExists $0 0 TextFunc_FileReadFromEnd_error
596 728 mdecorde
	FileOpen $0 $0 r
597 728 mdecorde
	IfErrors TextFunc_FileReadFromEnd_error
598 728 mdecorde
	FileRead $0 $9
599 728 mdecorde
	IfErrors +4
600 728 mdecorde
	Push $9
601 728 mdecorde
	IntOp $8 $8 + 1
602 728 mdecorde
	goto -4
603 728 mdecorde
	FileClose $0
604 728 mdecorde
605 728 mdecorde
	TextFunc_FileReadFromEnd_nextline:
606 728 mdecorde
	StrCmp $8 0 TextFunc_FileReadFromEnd_end
607 728 mdecorde
	Pop $9
608 728 mdecorde
	Push $1
609 728 mdecorde
	Push $7
610 728 mdecorde
	Push $8
611 728 mdecorde
	Call $1
612 728 mdecorde
	Pop $0
613 728 mdecorde
	Pop $8
614 728 mdecorde
	Pop $7
615 728 mdecorde
	Pop $1
616 728 mdecorde
	IntOp $7 $7 - 1
617 728 mdecorde
	IntOp $8 $8 - 1
618 728 mdecorde
	IfErrors TextFunc_FileReadFromEnd_error
619 728 mdecorde
	StrCmp $0 'StopFileReadFromEnd' TextFunc_FileReadFromEnd_clearstack TextFunc_FileReadFromEnd_nextline
620 728 mdecorde
621 728 mdecorde
	TextFunc_FileReadFromEnd_error:
622 728 mdecorde
	SetErrors
623 728 mdecorde
624 728 mdecorde
	TextFunc_FileReadFromEnd_clearstack:
625 728 mdecorde
	StrCmp $8 0 TextFunc_FileReadFromEnd_end
626 728 mdecorde
	Pop $9
627 728 mdecorde
	IntOp $8 $8 - 1
628 728 mdecorde
	goto TextFunc_FileReadFromEnd_clearstack
629 728 mdecorde
630 728 mdecorde
	TextFunc_FileReadFromEnd_end:
631 728 mdecorde
	Pop $9
632 728 mdecorde
	Pop $8
633 728 mdecorde
	Pop $7
634 728 mdecorde
	Pop $1
635 728 mdecorde
	Pop $0
636 728 mdecorde
637 728 mdecorde
	!verbose pop
638 728 mdecorde
!macroend
639 728 mdecorde
640 728 mdecorde
!define LineSum `!insertmacro LineSumCall`
641 728 mdecorde
!define un.LineSum `!insertmacro LineSumCall`
642 728 mdecorde
643 728 mdecorde
!macro LineSum
644 728 mdecorde
!macroend
645 728 mdecorde
646 728 mdecorde
!macro un.LineSum
647 728 mdecorde
!macroend
648 728 mdecorde
649 728 mdecorde
!macro LineSum_
650 728 mdecorde
	!verbose push
651 728 mdecorde
	!verbose ${_TEXTFUNC_VERBOSE}
652 728 mdecorde
653 728 mdecorde
	Exch $0
654 728 mdecorde
	Push $1
655 728 mdecorde
	Push $2
656 728 mdecorde
	ClearErrors
657 728 mdecorde
658 728 mdecorde
	IfFileExists $0 0 TextFunc_LineSum_error
659 728 mdecorde
	StrCpy $2 0
660 728 mdecorde
	FileOpen $0 $0 r
661 728 mdecorde
	IfErrors TextFunc_LineSum_error
662 728 mdecorde
	FileRead $0 $1
663 728 mdecorde
	IfErrors +3
664 728 mdecorde
	IntOp $2 $2 + 1
665 728 mdecorde
	Goto -3
666 728 mdecorde
	FileClose $0
667 728 mdecorde
	StrCpy $0 $2
668 728 mdecorde
	goto TextFunc_LineSum_end
669 728 mdecorde
670 728 mdecorde
	TextFunc_LineSum_error:
671 728 mdecorde
	SetErrors
672 728 mdecorde
	StrCpy $0 ''
673 728 mdecorde
674 728 mdecorde
	TextFunc_LineSum_end:
675 728 mdecorde
	Pop $2
676 728 mdecorde
	Pop $1
677 728 mdecorde
	Exch $0
678 728 mdecorde
679 728 mdecorde
	!verbose pop
680 728 mdecorde
!macroend
681 728 mdecorde
682 728 mdecorde
!define FileJoin `!insertmacro FileJoinCall`
683 728 mdecorde
!define un.FileJoin `!insertmacro FileJoinCall`
684 728 mdecorde
685 728 mdecorde
!macro FileJoin
686 728 mdecorde
!macroend
687 728 mdecorde
688 728 mdecorde
!macro un.FileJoin
689 728 mdecorde
!macroend
690 728 mdecorde
691 728 mdecorde
!macro FileJoin_
692 728 mdecorde
	!verbose push
693 728 mdecorde
	!verbose ${_TEXTFUNC_VERBOSE}
694 728 mdecorde
695 728 mdecorde
	Exch $2
696 728 mdecorde
	Exch
697 728 mdecorde
	Exch $1
698 728 mdecorde
	Exch
699 728 mdecorde
	Exch 2
700 728 mdecorde
	Exch $0
701 728 mdecorde
	Exch 2
702 728 mdecorde
	Push $3
703 728 mdecorde
	Push $4
704 728 mdecorde
	Push $5
705 728 mdecorde
	ClearErrors
706 728 mdecorde
707 728 mdecorde
	IfFileExists $0 0 TextFunc_FileJoin_error
708 728 mdecorde
	IfFileExists $1 0 TextFunc_FileJoin_error
709 728 mdecorde
	StrCpy $3 0
710 728 mdecorde
	IntOp $3 $3 - 1
711 728 mdecorde
	StrCpy $4 $2 1 $3
712 728 mdecorde
	StrCmp $4 \ +2
713 728 mdecorde
	StrCmp $4 '' +3 -3
714 728 mdecorde
	StrCpy $4 $2 $3
715 728 mdecorde
	IfFileExists '$4\*.*' 0 TextFunc_FileJoin_error
716 728 mdecorde
717 728 mdecorde
	StrCmp $2 $0 0 +2
718 728 mdecorde
	StrCpy $2 ''
719 728 mdecorde
	StrCmp $2 '' 0 +3
720 728 mdecorde
	StrCpy $4 $0
721 728 mdecorde
	Goto TextFunc_FileJoin_notemp
722 728 mdecorde
	!insertmacro _TextFunc_TempFileForFile $2 $4
723 728 mdecorde
	CopyFiles /SILENT $0 $4
724 728 mdecorde
	TextFunc_FileJoin_notemp:
725 728 mdecorde
	FileOpen $3 $4 a
726 728 mdecorde
	IfErrors TextFunc_FileJoin_error
727 728 mdecorde
	FileSeek $3 -1 END
728 728 mdecorde
	FileRead $3 $5
729 728 mdecorde
	StrCmp $5 '$\r' +3
730 728 mdecorde
	StrCmp $5 '$\n' +2
731 728 mdecorde
	FileWrite $3 '$\r$\n'
732 728 mdecorde
733 728 mdecorde
	;FileWrite $3 '$\r$\n--Divider--$\r$\n'
734 728 mdecorde
735 728 mdecorde
	FileOpen $0 $1 r
736 728 mdecorde
	IfErrors TextFunc_FileJoin_error
737 728 mdecorde
	FileRead $0 $5
738 728 mdecorde
	IfErrors +3
739 728 mdecorde
	FileWrite $3 $5
740 728 mdecorde
	goto -3
741 728 mdecorde
	FileClose $0
742 728 mdecorde
	FileClose $3
743 728 mdecorde
	StrCmp $2 '' TextFunc_FileJoin_end
744 728 mdecorde
	Delete '$EXEDIR\$2'
745 728 mdecorde
	Rename $4 '$EXEDIR\$2'
746 728 mdecorde
	IfErrors 0 TextFunc_FileJoin_end
747 728 mdecorde
	Delete $2
748 728 mdecorde
	Rename $4 $2
749 728 mdecorde
	IfErrors 0 TextFunc_FileJoin_end
750 728 mdecorde
751 728 mdecorde
	TextFunc_FileJoin_error:
752 728 mdecorde
	SetErrors
753 728 mdecorde
754 728 mdecorde
	TextFunc_FileJoin_end:
755 728 mdecorde
	Pop $5
756 728 mdecorde
	Pop $4
757 728 mdecorde
	Pop $3
758 728 mdecorde
	Pop $2
759 728 mdecorde
	Pop $1
760 728 mdecorde
	Pop $0
761 728 mdecorde
762 728 mdecorde
	!verbose pop
763 728 mdecorde
!macroend
764 728 mdecorde
765 728 mdecorde
!macro TextCompareBody _TEXTFUNC_S
766 728 mdecorde
	Exch $3
767 728 mdecorde
	Exch
768 728 mdecorde
	Exch $2
769 728 mdecorde
	Exch
770 728 mdecorde
	Exch 2
771 728 mdecorde
	Exch $1
772 728 mdecorde
	Exch 2
773 728 mdecorde
	Exch 3
774 728 mdecorde
	Exch $0
775 728 mdecorde
	Exch 3
776 728 mdecorde
	Push $4
777 728 mdecorde
	Push $5
778 728 mdecorde
	Push $6
779 728 mdecorde
	Push $7
780 728 mdecorde
	Push $8
781 728 mdecorde
	Push $9
782 728 mdecorde
	ClearErrors
783 728 mdecorde
784 728 mdecorde
	IfFileExists $0 0 TextFunc_TextCompare${_TEXTFUNC_S}_error
785 728 mdecorde
	IfFileExists $1 0 TextFunc_TextCompare${_TEXTFUNC_S}_error
786 728 mdecorde
	StrCmp $2 'FastDiff' +5
787 728 mdecorde
	StrCmp $2 'FastEqual' +4
788 728 mdecorde
	StrCmp $2 'SlowDiff' +3
789 728 mdecorde
	StrCmp $2 'SlowEqual' +2
790 728 mdecorde
	goto TextFunc_TextCompare${_TEXTFUNC_S}_error
791 728 mdecorde
792 728 mdecorde
	FileOpen $4 $0 r
793 728 mdecorde
	IfErrors TextFunc_TextCompare${_TEXTFUNC_S}_error
794 728 mdecorde
	FileOpen $5 $1 r
795 728 mdecorde
	IfErrors TextFunc_TextCompare${_TEXTFUNC_S}_error
796 728 mdecorde
	SetDetailsPrint textonly
797 728 mdecorde
798 728 mdecorde
	StrCpy $6 0
799 728 mdecorde
	StrCpy $8 0
800 728 mdecorde
801 728 mdecorde
	TextFunc_TextCompare${_TEXTFUNC_S}_nextline:
802 728 mdecorde
	StrCmp${_TEXTFUNC_S} $4 '' TextFunc_TextCompare${_TEXTFUNC_S}_fast
803 728 mdecorde
	IntOp $8 $8 + 1
804 728 mdecorde
	FileRead $4 $9
805 728 mdecorde
	IfErrors 0 +4
806 728 mdecorde
	FileClose $4
807 728 mdecorde
	StrCpy $4 ''
808 728 mdecorde
	StrCmp${_TEXTFUNC_S} $5 '' TextFunc_TextCompare${_TEXTFUNC_S}_end
809 728 mdecorde
	StrCmp $2 'FastDiff' TextFunc_TextCompare${_TEXTFUNC_S}_fast
810 728 mdecorde
	StrCmp $2 'FastEqual' TextFunc_TextCompare${_TEXTFUNC_S}_fast TextFunc_TextCompare${_TEXTFUNC_S}_slow
811 728 mdecorde
812 728 mdecorde
	TextFunc_TextCompare${_TEXTFUNC_S}_fast:
813 728 mdecorde
	StrCmp${_TEXTFUNC_S} $5 '' TextFunc_TextCompare${_TEXTFUNC_S}_call
814 728 mdecorde
	IntOp $6 $6 + 1
815 728 mdecorde
	FileRead $5 $7
816 728 mdecorde
	IfErrors 0 +5
817 728 mdecorde
	FileClose $5
818 728 mdecorde
	StrCpy $5 ''
819 728 mdecorde
	StrCmp${_TEXTFUNC_S} $4 '' TextFunc_TextCompare${_TEXTFUNC_S}_end
820 728 mdecorde
	StrCmp $2 'FastDiff' TextFunc_TextCompare${_TEXTFUNC_S}_call TextFunc_TextCompare${_TEXTFUNC_S}_close
821 728 mdecorde
	StrCmp $2 'FastDiff' 0 +2
822 728 mdecorde
	StrCmp${_TEXTFUNC_S} $7 $9 TextFunc_TextCompare${_TEXTFUNC_S}_nextline TextFunc_TextCompare${_TEXTFUNC_S}_call
823 728 mdecorde
	StrCmp${_TEXTFUNC_S} $7 $9 TextFunc_TextCompare${_TEXTFUNC_S}_call TextFunc_TextCompare${_TEXTFUNC_S}_nextline
824 728 mdecorde
825 728 mdecorde
	TextFunc_TextCompare${_TEXTFUNC_S}_slow:
826 728 mdecorde
	StrCmp${_TEXTFUNC_S} $4 '' TextFunc_TextCompare${_TEXTFUNC_S}_close
827 728 mdecorde
	StrCpy $6 ''
828 728 mdecorde
	DetailPrint '$8. $9'
829 728 mdecorde
	FileSeek $5 0
830 728 mdecorde
831 728 mdecorde
	TextFunc_TextCompare${_TEXTFUNC_S}_slownext:
832 728 mdecorde
	FileRead $5 $7
833 728 mdecorde
	IfErrors 0 +2
834 728 mdecorde
	StrCmp $2 'SlowDiff' TextFunc_TextCompare${_TEXTFUNC_S}_call TextFunc_TextCompare${_TEXTFUNC_S}_nextline
835 728 mdecorde
	StrCmp $2 'SlowDiff' 0 +2
836 728 mdecorde
	StrCmp${_TEXTFUNC_S} $7 $9 TextFunc_TextCompare${_TEXTFUNC_S}_nextline TextFunc_TextCompare${_TEXTFUNC_S}_slownext
837 728 mdecorde
	IntOp $6 $6 + 1
838 728 mdecorde
	StrCmp${_TEXTFUNC_S} $7 $9 0 TextFunc_TextCompare${_TEXTFUNC_S}_slownext
839 728 mdecorde
840 728 mdecorde
	TextFunc_TextCompare${_TEXTFUNC_S}_call:
841 728 mdecorde
	Push $2
842 728 mdecorde
	Push $3
843 728 mdecorde
	Push $4
844 728 mdecorde
	Push $5
845 728 mdecorde
	Push $6
846 728 mdecorde
	Push $7
847 728 mdecorde
	Push $8
848 728 mdecorde
	Push $9
849 728 mdecorde
	Call $3
850 728 mdecorde
	Pop $0
851 728 mdecorde
	Pop $9
852 728 mdecorde
	Pop $8
853 728 mdecorde
	Pop $7
854 728 mdecorde
	Pop $6
855 728 mdecorde
	Pop $5
856 728 mdecorde
	Pop $4
857 728 mdecorde
	Pop $3
858 728 mdecorde
	Pop $2
859 728 mdecorde
	StrCmp $0 'StopTextCompare' 0 TextFunc_TextCompare${_TEXTFUNC_S}_nextline
860 728 mdecorde
861 728 mdecorde
	TextFunc_TextCompare${_TEXTFUNC_S}_close:
862 728 mdecorde
	FileClose $4
863 728 mdecorde
	FileClose $5
864 728 mdecorde
	goto TextFunc_TextCompare${_TEXTFUNC_S}_end
865 728 mdecorde
866 728 mdecorde
	TextFunc_TextCompare${_TEXTFUNC_S}_error:
867 728 mdecorde
	SetErrors
868 728 mdecorde
869 728 mdecorde
	TextFunc_TextCompare${_TEXTFUNC_S}_end:
870 728 mdecorde
	SetDetailsPrint both
871 728 mdecorde
	Pop $9
872 728 mdecorde
	Pop $8
873 728 mdecorde
	Pop $7
874 728 mdecorde
	Pop $6
875 728 mdecorde
	Pop $5
876 728 mdecorde
	Pop $4
877 728 mdecorde
	Pop $3
878 728 mdecorde
	Pop $2
879 728 mdecorde
	Pop $1
880 728 mdecorde
	Pop $0
881 728 mdecorde
!macroend
882 728 mdecorde
883 728 mdecorde
!define TextCompare `!insertmacro TextCompareCall`
884 728 mdecorde
!define un.TextCompare `!insertmacro TextCompareCall`
885 728 mdecorde
886 728 mdecorde
!macro TextCompare
887 728 mdecorde
!macroend
888 728 mdecorde
889 728 mdecorde
!macro un.TextCompare
890 728 mdecorde
!macroend
891 728 mdecorde
892 728 mdecorde
!macro TextCompare_
893 728 mdecorde
	!verbose push
894 728 mdecorde
	!verbose ${_TEXTFUNC_VERBOSE}
895 728 mdecorde
896 728 mdecorde
	!insertmacro TextCompareBody ''
897 728 mdecorde
898 728 mdecorde
	!verbose pop
899 728 mdecorde
!macroend
900 728 mdecorde
901 728 mdecorde
!define TextCompareS `!insertmacro TextCompareSCall`
902 728 mdecorde
!define un.TextCompareS `!insertmacro TextCompareSCall`
903 728 mdecorde
904 728 mdecorde
!macro TextCompareS
905 728 mdecorde
!macroend
906 728 mdecorde
907 728 mdecorde
!macro un.TextCompareS
908 728 mdecorde
!macroend
909 728 mdecorde
910 728 mdecorde
!macro TextCompareS_
911 728 mdecorde
	!verbose push
912 728 mdecorde
	!verbose ${_TEXTFUNC_VERBOSE}
913 728 mdecorde
914 728 mdecorde
	!insertmacro TextCompareBody 'S'
915 728 mdecorde
916 728 mdecorde
	!verbose pop
917 728 mdecorde
!macroend
918 728 mdecorde
919 728 mdecorde
!macro ConfigReadBody _TEXTFUNC_S
920 728 mdecorde
	Exch $1
921 728 mdecorde
	Exch
922 728 mdecorde
	Exch $0
923 728 mdecorde
	Exch
924 728 mdecorde
	Push $2
925 728 mdecorde
	Push $3
926 728 mdecorde
	Push $4
927 728 mdecorde
	ClearErrors
928 728 mdecorde
929 728 mdecorde
	FileOpen $2 $0 r
930 728 mdecorde
	IfErrors TextFunc_ConfigRead${_TEXTFUNC_S}_error
931 728 mdecorde
	StrLen $0 $1
932 728 mdecorde
	StrCmp${_TEXTFUNC_S} $0 0 TextFunc_ConfigRead${_TEXTFUNC_S}_error
933 728 mdecorde
934 728 mdecorde
	TextFunc_ConfigRead${_TEXTFUNC_S}_readnext:
935 728 mdecorde
	FileRead $2 $3
936 728 mdecorde
	IfErrors TextFunc_ConfigRead${_TEXTFUNC_S}_error
937 728 mdecorde
	StrCpy $4 $3 $0
938 728 mdecorde
	StrCmp${_TEXTFUNC_S} $4 $1 0 TextFunc_ConfigRead${_TEXTFUNC_S}_readnext
939 728 mdecorde
	StrCpy $0 $3 '' $0
940 728 mdecorde
	StrCpy $4 $0 1 -1
941 728 mdecorde
	StrCmp${_TEXTFUNC_S} $4 '$\r' +2
942 728 mdecorde
	StrCmp${_TEXTFUNC_S} $4 '$\n' 0 TextFunc_ConfigRead${_TEXTFUNC_S}_close
943 728 mdecorde
	StrCpy $0 $0 -1
944 728 mdecorde
	goto -4
945 728 mdecorde
946 728 mdecorde
	TextFunc_ConfigRead${_TEXTFUNC_S}_error:
947 728 mdecorde
	SetErrors
948 728 mdecorde
	StrCpy $0 ''
949 728 mdecorde
950 728 mdecorde
	TextFunc_ConfigRead${_TEXTFUNC_S}_close:
951 728 mdecorde
	FileClose $2
952 728 mdecorde
953 728 mdecorde
	Pop $4
954 728 mdecorde
	Pop $3
955 728 mdecorde
	Pop $2
956 728 mdecorde
	Pop $1
957 728 mdecorde
	Exch $0
958 728 mdecorde
!macroend
959 728 mdecorde
960 728 mdecorde
!define ConfigRead `!insertmacro ConfigReadCall`
961 728 mdecorde
!define un.ConfigRead `!insertmacro ConfigReadCall`
962 728 mdecorde
963 728 mdecorde
!macro ConfigRead
964 728 mdecorde
!macroend
965 728 mdecorde
966 728 mdecorde
!macro un.ConfigRead
967 728 mdecorde
!macroend
968 728 mdecorde
969 728 mdecorde
!macro ConfigRead_
970 728 mdecorde
	!verbose push
971 728 mdecorde
	!verbose ${_TEXTFUNC_VERBOSE}
972 728 mdecorde
973 728 mdecorde
	!insertmacro ConfigReadBody ''
974 728 mdecorde
975 728 mdecorde
	!verbose pop
976 728 mdecorde
!macroend
977 728 mdecorde
978 728 mdecorde
!define ConfigReadS `!insertmacro ConfigReadSCall`
979 728 mdecorde
!define un.ConfigReadS `!insertmacro ConfigReadSCall`
980 728 mdecorde
981 728 mdecorde
!macro ConfigReadS
982 728 mdecorde
!macroend
983 728 mdecorde
984 728 mdecorde
!macro un.ConfigReadS
985 728 mdecorde
!macroend
986 728 mdecorde
987 728 mdecorde
!macro ConfigReadS_
988 728 mdecorde
	!verbose push
989 728 mdecorde
	!verbose ${_TEXTFUNC_VERBOSE}
990 728 mdecorde
991 728 mdecorde
	!insertmacro ConfigReadBody 'S'
992 728 mdecorde
993 728 mdecorde
	!verbose pop
994 728 mdecorde
!macroend
995 728 mdecorde
996 728 mdecorde
!macro ConfigWriteBody _TEXTFUNC_S
997 728 mdecorde
	Exch $2
998 728 mdecorde
	Exch
999 728 mdecorde
	Exch $1
1000 728 mdecorde
	Exch
1001 728 mdecorde
	Exch 2
1002 728 mdecorde
	Exch $0
1003 728 mdecorde
	Exch 2
1004 728 mdecorde
	Push $3
1005 728 mdecorde
	Push $4
1006 728 mdecorde
	Push $5
1007 728 mdecorde
	Push $6
1008 728 mdecorde
	ClearErrors
1009 728 mdecorde
1010 728 mdecorde
	IfFileExists $0 0 TextFunc_ConfigWrite${_TEXTFUNC_S}_error
1011 728 mdecorde
	FileOpen $3 $0 a
1012 728 mdecorde
	IfErrors TextFunc_ConfigWrite${_TEXTFUNC_S}_error
1013 728 mdecorde
1014 728 mdecorde
	StrLen $0 $1
1015 728 mdecorde
	StrCmp${_TEXTFUNC_S} $0 0 0 TextFunc_ConfigWrite${_TEXTFUNC_S}_readnext
1016 728 mdecorde
	StrCpy $0 ''
1017 728 mdecorde
	goto TextFunc_ConfigWrite${_TEXTFUNC_S}_close
1018 728 mdecorde
1019 728 mdecorde
	TextFunc_ConfigWrite${_TEXTFUNC_S}_readnext:
1020 728 mdecorde
	FileRead $3 $4
1021 728 mdecorde
	IfErrors TextFunc_ConfigWrite${_TEXTFUNC_S}_add
1022 728 mdecorde
	StrCpy $5 $4 $0
1023 728 mdecorde
	StrCmp${_TEXTFUNC_S} $5 $1 0 TextFunc_ConfigWrite${_TEXTFUNC_S}_readnext
1024 728 mdecorde
1025 728 mdecorde
	StrCpy $5 0
1026 728 mdecorde
	IntOp $5 $5 - 1
1027 728 mdecorde
	StrCpy $6 $4 1 $5
1028 728 mdecorde
	StrCmp${_TEXTFUNC_S} $6 '$\r' -2
1029 728 mdecorde
	StrCmp${_TEXTFUNC_S} $6 '$\n' -3
1030 728 mdecorde
	StrCpy $6 $4
1031 728 mdecorde
	StrCmp${_TEXTFUNC_S} $5 -1 +3
1032 728 mdecorde
	IntOp $5 $5 + 1
1033 728 mdecorde
	StrCpy $6 $4 $5
1034 728 mdecorde
1035 728 mdecorde
	StrCmp${_TEXTFUNC_S} $2 '' TextFunc_ConfigWrite${_TEXTFUNC_S}_change
1036 728 mdecorde
	StrCmp${_TEXTFUNC_S} $6 '$1$2' 0 TextFunc_ConfigWrite${_TEXTFUNC_S}_change
1037 728 mdecorde
	StrCpy $0 SAME
1038 728 mdecorde
	goto TextFunc_ConfigWrite${_TEXTFUNC_S}_close
1039 728 mdecorde
1040 728 mdecorde
	TextFunc_ConfigWrite${_TEXTFUNC_S}_change:
1041 728 mdecorde
	FileSeek $3 0 CUR $5
1042 728 mdecorde
	StrLen $4 $4
1043 728 mdecorde
	IntOp $4 $5 - $4
1044 728 mdecorde
	FileSeek $3 0 END $6
1045 728 mdecorde
	IntOp $6 $6 - $5
1046 728 mdecorde
1047 728 mdecorde
	System::Alloc $6
1048 728 mdecorde
	Pop $0
1049 728 mdecorde
	FileSeek $3 $5 SET
1050 728 mdecorde
	System::Call 'kernel32::ReadFile(i r3, i r0, i $6, t.,)'
1051 728 mdecorde
	FileSeek $3 $4 SET
1052 728 mdecorde
	StrCmp${_TEXTFUNC_S} $2 '' +2
1053 728 mdecorde
	FileWrite $3 '$1$2$\r$\n'
1054 728 mdecorde
	System::Call 'kernel32::WriteFile(i r3, i r0, i $6, t.,)'
1055 728 mdecorde
	System::Call 'kernel32::SetEndOfFile(i r3)'
1056 728 mdecorde
	System::Free $0
1057 728 mdecorde
	StrCmp${_TEXTFUNC_S} $2 '' +3
1058 728 mdecorde
	StrCpy $0 CHANGED
1059 728 mdecorde
	goto TextFunc_ConfigWrite${_TEXTFUNC_S}_close
1060 728 mdecorde
	StrCpy $0 DELETED
1061 728 mdecorde
	goto TextFunc_ConfigWrite${_TEXTFUNC_S}_close
1062 728 mdecorde
1063 728 mdecorde
	TextFunc_ConfigWrite${_TEXTFUNC_S}_add:
1064 728 mdecorde
	StrCmp${_TEXTFUNC_S} $2 '' 0 +3
1065 728 mdecorde
	StrCpy $0 SAME
1066 728 mdecorde
	goto TextFunc_ConfigWrite${_TEXTFUNC_S}_close
1067 728 mdecorde
	FileSeek $3 -1 END
1068 728 mdecorde
	FileRead $3 $4
1069 728 mdecorde
	IfErrors +4
1070 728 mdecorde
	StrCmp${_TEXTFUNC_S} $4 '$\r' +3
1071 728 mdecorde
	StrCmp${_TEXTFUNC_S} $4 '$\n' +2
1072 728 mdecorde
	FileWrite $3 '$\r$\n'
1073 728 mdecorde
	FileWrite $3 '$1$2$\r$\n'
1074 728 mdecorde
	StrCpy $0 ADDED
1075 728 mdecorde
1076 728 mdecorde
	TextFunc_ConfigWrite${_TEXTFUNC_S}_close:
1077 728 mdecorde
	FileClose $3
1078 728 mdecorde
	goto TextFunc_ConfigWrite${_TEXTFUNC_S}_end
1079 728 mdecorde
1080 728 mdecorde
	TextFunc_ConfigWrite${_TEXTFUNC_S}_error:
1081 728 mdecorde
	SetErrors
1082 728 mdecorde
	StrCpy $0 ''
1083 728 mdecorde
1084 728 mdecorde
	TextFunc_ConfigWrite${_TEXTFUNC_S}_end:
1085 728 mdecorde
	Pop $6
1086 728 mdecorde
	Pop $5
1087 728 mdecorde
	Pop $4
1088 728 mdecorde
	Pop $3
1089 728 mdecorde
	Pop $2
1090 728 mdecorde
	Pop $1
1091 728 mdecorde
	Exch $0
1092 728 mdecorde
!macroend
1093 728 mdecorde
1094 728 mdecorde
!define ConfigWrite `!insertmacro ConfigWriteCall`
1095 728 mdecorde
!define un.ConfigWrite `!insertmacro ConfigWriteCall`
1096 728 mdecorde
1097 728 mdecorde
!macro ConfigWrite
1098 728 mdecorde
!macroend
1099 728 mdecorde
1100 728 mdecorde
!macro un.ConfigWrite
1101 728 mdecorde
!macroend
1102 728 mdecorde
1103 728 mdecorde
!macro ConfigWrite_
1104 728 mdecorde
	!verbose push
1105 728 mdecorde
	!verbose ${_TEXTFUNC_VERBOSE}
1106 728 mdecorde
1107 728 mdecorde
	!insertmacro ConfigWriteBody ''
1108 728 mdecorde
1109 728 mdecorde
	!verbose pop
1110 728 mdecorde
!macroend
1111 728 mdecorde
1112 728 mdecorde
!define ConfigWriteS `!insertmacro ConfigWriteSCall`
1113 728 mdecorde
!define un.ConfigWriteS `!insertmacro ConfigWriteSCall`
1114 728 mdecorde
1115 728 mdecorde
!macro ConfigWriteS
1116 728 mdecorde
!macroend
1117 728 mdecorde
1118 728 mdecorde
!macro un.ConfigWriteS
1119 728 mdecorde
!macroend
1120 728 mdecorde
1121 728 mdecorde
!macro ConfigWriteS_
1122 728 mdecorde
	!verbose push
1123 728 mdecorde
	!verbose ${_TEXTFUNC_VERBOSE}
1124 728 mdecorde
1125 728 mdecorde
	!insertmacro ConfigWriteBody 'S'
1126 728 mdecorde
1127 728 mdecorde
	!verbose pop
1128 728 mdecorde
!macroend
1129 728 mdecorde
1130 728 mdecorde
!define FileRecode `!insertmacro FileRecodeCall`
1131 728 mdecorde
!define un.FileRecode `!insertmacro FileRecodeCall`
1132 728 mdecorde
1133 728 mdecorde
!macro FileRecode
1134 728 mdecorde
!macroend
1135 728 mdecorde
1136 728 mdecorde
!macro un.FileRecode
1137 728 mdecorde
!macroend
1138 728 mdecorde
1139 728 mdecorde
!macro FileRecode_
1140 728 mdecorde
	!verbose push
1141 728 mdecorde
	!verbose ${_TEXTFUNC_VERBOSE}
1142 728 mdecorde
1143 728 mdecorde
	Exch $1
1144 728 mdecorde
	Exch
1145 728 mdecorde
	Exch $0
1146 728 mdecorde
	Exch
1147 728 mdecorde
	Push $2
1148 728 mdecorde
	Push $3
1149 728 mdecorde
	Push $4
1150 728 mdecorde
1151 728 mdecorde
	IfFileExists $0 0 TextFunc_FileRecode_error
1152 728 mdecorde
	StrCmp $1 OemToChar +2
1153 728 mdecorde
	StrCmp $1 CharToOem 0 TextFunc_FileRecode_error
1154 728 mdecorde
1155 728 mdecorde
	FileOpen $2 $0 a
1156 728 mdecorde
	FileSeek $2 0 END $3
1157 728 mdecorde
	System::Alloc $3
1158 728 mdecorde
	Pop $4
1159 728 mdecorde
	FileSeek $2 0 SET
1160 728 mdecorde
	System::Call 'kernel32::ReadFile(i r2, i r4, i $3, t.,)'
1161 728 mdecorde
	System::Call 'user32::$1Buff(i r4, i r4, i $3)'
1162 728 mdecorde
	FileSeek $2 0 SET
1163 728 mdecorde
	System::Call 'kernel32::WriteFile(i r2, i r4, i $3, t.,)'
1164 728 mdecorde
	System::Free $4
1165 728 mdecorde
	FileClose $2
1166 728 mdecorde
	goto TextFunc_FileRecode_end
1167 728 mdecorde
1168 728 mdecorde
	TextFunc_FileRecode_error:
1169 728 mdecorde
	SetErrors
1170 728 mdecorde
1171 728 mdecorde
	TextFunc_FileRecode_end:
1172 728 mdecorde
	Pop $4
1173 728 mdecorde
	Pop $3
1174 728 mdecorde
	Pop $2
1175 728 mdecorde
	Pop $1
1176 728 mdecorde
	Pop $0
1177 728 mdecorde
1178 728 mdecorde
	!verbose pop
1179 728 mdecorde
!macroend
1180 728 mdecorde
1181 728 mdecorde
!define TrimNewLines `!insertmacro TrimNewLinesCall`
1182 728 mdecorde
!define un.TrimNewLines `!insertmacro TrimNewLinesCall`
1183 728 mdecorde
1184 728 mdecorde
!macro TrimNewLines
1185 728 mdecorde
!macroend
1186 728 mdecorde
1187 728 mdecorde
!macro un.TrimNewLines
1188 728 mdecorde
!macroend
1189 728 mdecorde
1190 728 mdecorde
!macro TrimNewLines_
1191 728 mdecorde
	!verbose push
1192 728 mdecorde
	!verbose ${_TEXTFUNC_VERBOSE}
1193 728 mdecorde
1194 728 mdecorde
	Exch $0
1195 728 mdecorde
	Push $1
1196 728 mdecorde
	Push $2
1197 728 mdecorde
1198 728 mdecorde
	StrCpy $1 0
1199 728 mdecorde
	IntOp $1 $1 - 1
1200 728 mdecorde
	StrCpy $2 $0 1 $1
1201 728 mdecorde
	StrCmp $2 '$\r' -2
1202 728 mdecorde
	StrCmp $2 '$\n' -3
1203 728 mdecorde
	StrCmp $1 -1 +3
1204 728 mdecorde
	IntOp $1 $1 + 1
1205 728 mdecorde
	StrCpy $0 $0 $1
1206 728 mdecorde
1207 728 mdecorde
	Pop $2
1208 728 mdecorde
	Pop $1
1209 728 mdecorde
	Exch $0
1210 728 mdecorde
1211 728 mdecorde
	!verbose pop
1212 728 mdecorde
!macroend
1213 728 mdecorde
1214 728 mdecorde
!endif