Statistiques
| Révision :

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

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