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