Updates by Instructor

1. "WordReplace"
   -Added options "{", "}", "{*", "}*"

2. "GetOptions"
   -Now sets error flag if option does not found

3. "ConfigRead"
   -Now sets error flag if entry does not found

4. New case sensitive functions:
      "WordFindS", "WordFind2XS", "WordFind3XS", "WordReplaceS",
      "WordAddS", "WordInsertS", "StrFilterS", "TextCompareS",
      "ConfigReadS", "ConfigWriteS", "GetOptionsS"


git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@4517 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2006-02-10 10:46:57 +00:00
parent 082160fb3e
commit aa43f0c349
9 changed files with 1534 additions and 572 deletions

View file

@ -1,10 +1,10 @@
/*
_____________________________________________________________________________
File Functions Header v2.9
File Functions Header v3.0
_____________________________________________________________________________
2005 Shengalts Aleksander aka Instructor (Shengalts@mail.ru)
2006 Shengalts Aleksander aka Instructor (Shengalts@mail.ru)
See documentation for more information about the following functions.
@ -18,14 +18,14 @@ _____________________________________________________________________________
FileFunction=[Locate|GetSize|DriveSpace|GetDrives|GetTime|GetFileAttributes|
GetFileVersion|GetExeName|GetExePath|GetParameters|GetOptions|
GetRoot|GetParent|GetFileName|GetBaseName|GetFileExt|
GetOptionsS|GetRoot|GetParent|GetFileName|GetBaseName|GetFileExt|
BannerTrimPath|DirState|RefreshShellIcons]
un.FileFunction=[un.Locate|un.GetSize|un.DriveSpace|un.GetDrives|un.GetTime|
un.GetFileAttributes|un.GetFileVersion|un.GetExeName|
un.GetExePath|un.GetParameters|un.GetOptions|un.GetRoot|
un.GetParent|un.GetFileName|un.GetBaseName|un.GetFileExt|
un.BannerTrimPath|un.DirState|un.RefreshShellIcons]
un.GetExePath|un.GetParameters|un.GetOptions|un.GetOptionsS|
un.GetRoot|un.GetParent|un.GetFileName|un.GetBaseName|
un.GetFileExt|un.BannerTrimPath|un.DirState|un.RefreshShellIcons]
_____________________________________________________________________________
@ -61,7 +61,7 @@ RefreshShellIcons
;_____________________________________________________________________________
;
; Macros
; Macros
;_____________________________________________________________________________
;
; Change log window verbosity (default: 3=no script)
@ -70,7 +70,7 @@ RefreshShellIcons
; !include "FileFunc.nsh"
; !insertmacro Locate
; ${FILEFUNC_VERBOSE} 4 # all verbosity
; !insertmacro GetTime
; !insertmacro VersionCompare
; ${FILEFUNC_VERBOSE} 3 # no script
!verbose push
@ -81,6 +81,7 @@ RefreshShellIcons
!verbose ${_FILEFUNC_VERBOSE}
!define FILEFUNC_VERBOSE `!insertmacro FILEFUNC_VERBOSE`
!define _FILEFUNC_UN
!define _FILEFUNC_S
!verbose pop
!macro FILEFUNC_VERBOSE _VERBOSE
@ -88,12 +89,12 @@ RefreshShellIcons
!verbose 3
!undef _FILEFUNC_VERBOSE
!define _FILEFUNC_VERBOSE ${_VERBOSE}
!verbose 4
!echo `"verbosity=${_VERBOSE}"`
!verbose pop
!macroend
# Install. Case insensitive. #
!macro LocateCall _PATH _OPTIONS _FUNC
!verbose push
!verbose ${_FILEFUNC_VERBOSE}
@ -563,8 +564,6 @@ RefreshShellIcons
Pop $0
FunctionEnd
!undef _FILEFUNC_UN
!define _FILEFUNC_UN
!verbose pop
!endif
!macroend
@ -796,8 +795,6 @@ RefreshShellIcons
Exch $0
FunctionEnd
!undef _FILEFUNC_UN
!define _FILEFUNC_UN
!verbose pop
!endif
!macroend
@ -913,8 +910,6 @@ RefreshShellIcons
Exch $0
FunctionEnd
!undef _FILEFUNC_UN
!define _FILEFUNC_UN
!verbose pop
!endif
!macroend
@ -1041,8 +1036,6 @@ RefreshShellIcons
Pop $0
FunctionEnd
!undef _FILEFUNC_UN
!define _FILEFUNC_UN
!verbose pop
!endif
!macroend
@ -1178,8 +1171,6 @@ RefreshShellIcons
Exch $0
FunctionEnd
!undef _FILEFUNC_UN
!define _FILEFUNC_UN
!verbose pop
!endif
!macroend
@ -1327,8 +1318,6 @@ RefreshShellIcons
Exch $0
FunctionEnd
!undef _FILEFUNC_UN
!define _FILEFUNC_UN
!verbose pop
!endif
!macroend
@ -1372,8 +1361,6 @@ RefreshShellIcons
Exch $0
FunctionEnd
!undef _FILEFUNC_UN
!define _FILEFUNC_UN
!verbose pop
!endif
!macroend
@ -1397,8 +1384,6 @@ RefreshShellIcons
Exch $0
FunctionEnd
!undef _FILEFUNC_UN
!define _FILEFUNC_UN
!verbose pop
!endif
!macroend
@ -1422,8 +1407,6 @@ RefreshShellIcons
Exch $0
FunctionEnd
!undef _FILEFUNC_UN
!define _FILEFUNC_UN
!verbose pop
!endif
!macroend
@ -1467,19 +1450,17 @@ RefreshShellIcons
Exch $0
FunctionEnd
!undef _FILEFUNC_UN
!define _FILEFUNC_UN
!verbose pop
!endif
!macroend
!macro GetOptions
!ifndef ${_FILEFUNC_UN}GetOptions
!ifndef ${_FILEFUNC_UN}GetOptions${_FILEFUNC_S}
!verbose push
!verbose ${_FILEFUNC_VERBOSE}
!define ${_FILEFUNC_UN}GetOptions `!insertmacro ${_FILEFUNC_UN}GetOptionsCall`
!define ${_FILEFUNC_UN}GetOptions${_FILEFUNC_S} `!insertmacro ${_FILEFUNC_UN}GetOptions${_FILEFUNC_S}Call`
Function ${_FILEFUNC_UN}GetOptions
Function ${_FILEFUNC_UN}GetOptions${_FILEFUNC_S}
Exch $1
Exch
Exch $0
@ -1490,6 +1471,7 @@ RefreshShellIcons
Push $5
Push $6
Push $7
ClearErrors
StrCpy $2 $1 '' 1
StrCpy $1 $1 1
@ -1503,44 +1485,44 @@ RefreshShellIcons
quote:
IntOp $4 $4 + 1
StrCpy $5 $0 1 $4
StrCmp $5$7 '0' notfound
StrCmp $5 '' trimright
StrCmp $5 '"' 0 +7
StrCmp $6 '' 0 +3
StrCmp${_FILEFUNC_S} $5$7 '0' notfound
StrCmp${_FILEFUNC_S} $5 '' trimright
StrCmp${_FILEFUNC_S} $5 '"' 0 +7
StrCmp${_FILEFUNC_S} $6 '' 0 +3
StrCpy $6 '"'
goto quote
StrCmp $6 '"' 0 +3
StrCmp${_FILEFUNC_S} $6 '"' 0 +3
StrCpy $6 ''
goto quote
StrCmp $5 `'` 0 +7
StrCmp $6 `` 0 +3
StrCmp${_FILEFUNC_S} $5 `'` 0 +7
StrCmp${_FILEFUNC_S} $6 `` 0 +3
StrCpy $6 `'`
goto quote
StrCmp $6 `'` 0 +3
StrCmp${_FILEFUNC_S} $6 `'` 0 +3
StrCpy $6 ``
goto quote
StrCmp $5 '`' 0 +7
StrCmp $6 '' 0 +3
StrCmp${_FILEFUNC_S} $5 '`' 0 +7
StrCmp${_FILEFUNC_S} $6 '' 0 +3
StrCpy $6 '`'
goto quote
StrCmp $6 '`' 0 +3
StrCmp${_FILEFUNC_S} $6 '`' 0 +3
StrCpy $6 ''
goto quote
StrCmp $6 '"' quote
StrCmp $6 `'` quote
StrCmp $6 '`' quote
StrCmp $5 $1 0 quote
StrCmp $7 0 trimleft trimright
StrCmp${_FILEFUNC_S} $6 '"' quote
StrCmp${_FILEFUNC_S} $6 `'` quote
StrCmp${_FILEFUNC_S} $6 '`' quote
StrCmp${_FILEFUNC_S} $5 $1 0 quote
StrCmp${_FILEFUNC_S} $7 0 trimleft trimright
trimleft:
IntOp $4 $4 + 1
StrCpy $5 $0 $3 $4
StrCmp $5 '' notfound
StrCmp $5 $2 0 quote
StrCmp${_FILEFUNC_S} $5 '' notfound
StrCmp${_FILEFUNC_S} $5 $2 0 quote
IntOp $4 $4 + $3
StrCpy $0 $0 '' $4
StrCpy $4 $0 1
StrCmp $4 ' ' 0 +3
StrCmp${_FILEFUNC_S} $4 ' ' 0 +3
StrCpy $0 $0 '' 1
goto -3
StrCpy $7 1
@ -1549,19 +1531,20 @@ RefreshShellIcons
trimright:
StrCpy $0 $0 $4
StrCpy $4 $0 1 -1
StrCmp $4 ' ' 0 +3
StrCmp${_FILEFUNC_S} $4 ' ' 0 +3
StrCpy $0 $0 -1
goto -3
StrCpy $3 $0 1
StrCpy $4 $0 1 -1
StrCmp $3 $4 0 end
StrCmp $3 '"' +3
StrCmp $3 `'` +2
StrCmp $3 '`' 0 end
StrCmp${_FILEFUNC_S} $3 $4 0 end
StrCmp${_FILEFUNC_S} $3 '"' +3
StrCmp${_FILEFUNC_S} $3 `'` +2
StrCmp${_FILEFUNC_S} $3 '`' 0 end
StrCpy $0 $0 -1 1
goto end
notfound:
SetErrors
StrCpy $0 ''
end:
@ -1575,8 +1558,6 @@ RefreshShellIcons
Exch $0
FunctionEnd
!undef _FILEFUNC_UN
!define _FILEFUNC_UN
!verbose pop
!endif
!macroend
@ -1628,8 +1609,6 @@ RefreshShellIcons
Exch $0
FunctionEnd
!undef _FILEFUNC_UN
!define _FILEFUNC_UN
!verbose pop
!endif
!macroend
@ -1662,8 +1641,6 @@ RefreshShellIcons
Exch $0
FunctionEnd
!undef _FILEFUNC_UN
!define _FILEFUNC_UN
!verbose pop
!endif
!macroend
@ -1698,8 +1675,6 @@ RefreshShellIcons
Exch $0
FunctionEnd
!undef _FILEFUNC_UN
!define _FILEFUNC_UN
!verbose pop
!endif
!macroend
@ -1747,8 +1722,6 @@ RefreshShellIcons
Exch $0
FunctionEnd
!undef _FILEFUNC_UN
!define _FILEFUNC_UN
!verbose pop
!endif
!macroend
@ -1787,8 +1760,6 @@ RefreshShellIcons
Exch $0
FunctionEnd
!undef _FILEFUNC_UN
!define _FILEFUNC_UN
!verbose pop
!endif
!macroend
@ -1882,8 +1853,6 @@ RefreshShellIcons
Exch $0
FunctionEnd
!undef _FILEFUNC_UN
!define _FILEFUNC_UN
!verbose pop
!endif
!macroend
@ -1918,8 +1887,6 @@ RefreshShellIcons
Exch $0
FunctionEnd
!undef _FILEFUNC_UN
!define _FILEFUNC_UN
!verbose pop
!endif
!macroend
@ -1934,12 +1901,13 @@ RefreshShellIcons
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)'
FunctionEnd
!undef _FILEFUNC_UN
!define _FILEFUNC_UN
!verbose pop
!endif
!macroend
# Uninstall. Case insensitive. #
!macro un.LocateCall _PATH _OPTIONS _FUNC
!verbose push
!verbose ${_FILEFUNC_VERBOSE}
@ -2136,6 +2104,8 @@ RefreshShellIcons
!insertmacro Locate
!undef _FILEFUNC_UN
!define _FILEFUNC_UN
!verbose pop
!endif
!macroend
@ -2149,6 +2119,8 @@ RefreshShellIcons
!insertmacro GetSize
!undef _FILEFUNC_UN
!define _FILEFUNC_UN
!verbose pop
!endif
!macroend
@ -2162,6 +2134,8 @@ RefreshShellIcons
!insertmacro DriveSpace
!undef _FILEFUNC_UN
!define _FILEFUNC_UN
!verbose pop
!endif
!macroend
@ -2175,6 +2149,8 @@ RefreshShellIcons
!insertmacro GetDrives
!undef _FILEFUNC_UN
!define _FILEFUNC_UN
!verbose pop
!endif
!macroend
@ -2188,6 +2164,8 @@ RefreshShellIcons
!insertmacro GetTime
!undef _FILEFUNC_UN
!define _FILEFUNC_UN
!verbose pop
!endif
!macroend
@ -2201,6 +2179,8 @@ RefreshShellIcons
!insertmacro GetFileAttributes
!undef _FILEFUNC_UN
!define _FILEFUNC_UN
!verbose pop
!endif
!macroend
@ -2214,6 +2194,8 @@ RefreshShellIcons
!insertmacro GetFileVersion
!undef _FILEFUNC_UN
!define _FILEFUNC_UN
!verbose pop
!endif
!macroend
@ -2227,6 +2209,8 @@ RefreshShellIcons
!insertmacro GetExeName
!undef _FILEFUNC_UN
!define _FILEFUNC_UN
!verbose pop
!endif
!macroend
@ -2240,6 +2224,8 @@ RefreshShellIcons
!insertmacro GetExePath
!undef _FILEFUNC_UN
!define _FILEFUNC_UN
!verbose pop
!endif
!macroend
@ -2253,6 +2239,8 @@ RefreshShellIcons
!insertmacro GetParameters
!undef _FILEFUNC_UN
!define _FILEFUNC_UN
!verbose pop
!endif
!macroend
@ -2266,6 +2254,8 @@ RefreshShellIcons
!insertmacro GetOptions
!undef _FILEFUNC_UN
!define _FILEFUNC_UN
!verbose pop
!endif
!macroend
@ -2279,6 +2269,8 @@ RefreshShellIcons
!insertmacro GetRoot
!undef _FILEFUNC_UN
!define _FILEFUNC_UN
!verbose pop
!endif
!macroend
@ -2292,6 +2284,8 @@ RefreshShellIcons
!insertmacro GetParent
!undef _FILEFUNC_UN
!define _FILEFUNC_UN
!verbose pop
!endif
!macroend
@ -2305,6 +2299,8 @@ RefreshShellIcons
!insertmacro GetFileName
!undef _FILEFUNC_UN
!define _FILEFUNC_UN
!verbose pop
!endif
!macroend
@ -2318,6 +2314,8 @@ RefreshShellIcons
!insertmacro GetBaseName
!undef _FILEFUNC_UN
!define _FILEFUNC_UN
!verbose pop
!endif
!macroend
@ -2331,6 +2329,8 @@ RefreshShellIcons
!insertmacro GetFileExt
!undef _FILEFUNC_UN
!define _FILEFUNC_UN
!verbose pop
!endif
!macroend
@ -2344,6 +2344,8 @@ RefreshShellIcons
!insertmacro BannerTrimPath
!undef _FILEFUNC_UN
!define _FILEFUNC_UN
!verbose pop
!endif
!macroend
@ -2357,6 +2359,8 @@ RefreshShellIcons
!insertmacro DirState
!undef _FILEFUNC_UN
!define _FILEFUNC_UN
!verbose pop
!endif
!macroend
@ -2370,6 +2374,68 @@ RefreshShellIcons
!insertmacro RefreshShellIcons
!undef _FILEFUNC_UN
!define _FILEFUNC_UN
!verbose pop
!endif
!macroend
# Install. Case sensitive. #
!macro GetOptionsSCall _PARAMETERS _OPTION _RESULT
!verbose push
!verbose ${_FILEFUNC_VERBOSE}
Push `${_PARAMETERS}`
Push `${_OPTION}`
Call GetOptionsS
Pop ${_RESULT}
!verbose pop
!macroend
!macro GetOptionsS
!ifndef GetOptionsS
!verbose push
!verbose ${_FILEFUNC_VERBOSE}
!undef _FILEFUNC_S
!define _FILEFUNC_S `S`
!insertmacro GetOptions
!undef _FILEFUNC_S
!define _FILEFUNC_S
!verbose pop
!endif
!macroend
# Uninstall. Case sensitive. #
!macro un.GetOptionsSCall _PARAMETERS _OPTION _RESULT
!verbose push
!verbose ${_FILEFUNC_VERBOSE}
Push `${_PARAMETERS}`
Push `${_OPTION}`
Call un.GetOptionsS
Pop ${_RESULT}
!verbose pop
!macroend
!macro un.GetOptionsS
!ifndef un.GetOptionsS
!verbose push
!verbose ${_FILEFUNC_VERBOSE}
!undef _FILEFUNC_UN
!define _FILEFUNC_UN `un.`
!undef _FILEFUNC_S
!define _FILEFUNC_S `S`
!insertmacro GetOptions
!undef _FILEFUNC_UN
!define _FILEFUNC_UN
!undef _FILEFUNC_S
!define _FILEFUNC_S
!verbose pop
!endif
!macroend

View file

@ -1,10 +1,10 @@
/*
_____________________________________________________________________________
Text Functions Header v2.1
Text Functions Header v2.2
_____________________________________________________________________________
2005 Shengalts Aleksander aka Instructor (Shengalts@mail.ru)
2006 Shengalts Aleksander aka Instructor (Shengalts@mail.ru)
See documentation for more information about the following functions.
@ -17,12 +17,13 @@ _____________________________________________________________________________
TextFunction=[LineFind|LineRead|FileReadFromEnd|LineSum|FileJoin|
TextCompare|ConfigRead|ConfigWrite|FileRecode|TrimNewLines]
TextCompare|TextCompareS|ConfigRead|ConfigReadS|
ConfigWrite|ConfigWriteS|FileRecode|TrimNewLines]
un.TextFunction=[un.LineFind|un.LineRead|un.FileReadFromEnd|un.LineSum|
un.FileJoin|un.TextCompare|un.ConfigRead|un.ConfigWrite|
un.FileRecode|un.TrimNewLines]
un.FileJoin|un.TextCompare|un.TextCompareS|un.ConfigRead|
un.ConfigReadS|un.ConfigWrite|un.ConfigWriteS|un.FileRecode|
un.TrimNewLines]
_____________________________________________________________________________
@ -66,6 +67,7 @@ TrimNewLines
!verbose ${_TEXTFUNC_VERBOSE}
!define TEXTFUNC_VERBOSE `!insertmacro TEXTFUNC_VERBOSE`
!define _TEXTFUNC_UN
!define _TEXTFUNC_S
!verbose pop
!macro TEXTFUNC_VERBOSE _VERBOSE
@ -73,12 +75,12 @@ TrimNewLines
!verbose 3
!undef _TEXTFUNC_VERBOSE
!define _TEXTFUNC_VERBOSE ${_VERBOSE}
!verbose 4
!echo `"verbosity=${_VERBOSE}"`
!verbose pop
!macroend
# Install. Case insensitive. #
!macro LineFindCall _INPUT _OUTPUT _RANGE _FUNC
!verbose push
!verbose ${_TEXTFUNC_VERBOSE}
@ -432,8 +434,6 @@ TrimNewLines
Pop $0
FunctionEnd
!undef _TEXTFUNC_UN
!define _TEXTFUNC_UN
!verbose pop
!endif
!macroend
@ -493,8 +493,6 @@ TrimNewLines
Exch $0
FunctionEnd
!undef _TEXTFUNC_UN
!define _TEXTFUNC_UN
!verbose pop
!endif
!macroend
@ -560,8 +558,6 @@ TrimNewLines
Pop $0
FunctionEnd
!undef _TEXTFUNC_UN
!define _TEXTFUNC_UN
!verbose pop
!endif
!macroend
@ -600,8 +596,6 @@ TrimNewLines
Exch $0
FunctionEnd
!undef _TEXTFUNC_UN
!define _TEXTFUNC_UN
!verbose pop
!endif
!macroend
@ -680,19 +674,17 @@ TrimNewLines
Pop $0
FunctionEnd
!undef _TEXTFUNC_UN
!define _TEXTFUNC_UN
!verbose pop
!endif
!macroend
!macro TextCompare
!ifndef ${_TEXTFUNC_UN}TextCompare
!ifndef ${_TEXTFUNC_UN}TextCompare${_TEXTFUNC_S}
!verbose push
!verbose ${_TEXTFUNC_VERBOSE}
!define ${_TEXTFUNC_UN}TextCompare `!insertmacro ${_TEXTFUNC_UN}TextCompareCall`
!define ${_TEXTFUNC_UN}TextCompare${_TEXTFUNC_S} `!insertmacro ${_TEXTFUNC_UN}TextCompare${_TEXTFUNC_S}Call`
Function ${_TEXTFUNC_UN}TextCompare
Function ${_TEXTFUNC_UN}TextCompare${_TEXTFUNC_S}
Exch $3
Exch
Exch $2
@ -729,31 +721,31 @@ TrimNewLines
StrCpy $8 0
nextline:
StrCmp $4 '' fast
StrCmp${_TEXTFUNC_S} $4 '' fast
IntOp $8 $8 + 1
FileRead $4 $9
IfErrors 0 +4
FileClose $4
StrCpy $4 ''
StrCmp $5 '' end
StrCmp${_TEXTFUNC_S} $5 '' end
StrCmp $2 'FastDiff' fast
StrCmp $2 'FastEqual' fast slow
fast:
StrCmp $5 '' call
StrCmp${_TEXTFUNC_S} $5 '' call
IntOp $6 $6 + 1
FileRead $5 $7
IfErrors 0 +5
FileClose $5
StrCpy $5 ''
StrCmp $4 '' end
StrCmp${_TEXTFUNC_S} $4 '' end
StrCmp $2 'FastDiff' call close
StrCmp $2 'FastDiff' 0 +2
StrCmp $7 $9 nextline call
StrCmp $7 $9 call nextline
StrCmp${_TEXTFUNC_S} $7 $9 nextline call
StrCmp${_TEXTFUNC_S} $7 $9 call nextline
slow:
StrCmp $4 '' close
StrCmp${_TEXTFUNC_S} $4 '' close
StrCpy $6 ''
DetailPrint '$8. $9'
FileSeek $5 0
@ -763,9 +755,9 @@ TrimNewLines
IfErrors 0 +2
StrCmp $2 'SlowDiff' call nextline
StrCmp $2 'SlowDiff' 0 +2
StrCmp $7 $9 nextline slownext
StrCmp${_TEXTFUNC_S} $7 $9 nextline slownext
IntOp $6 $6 + 1
StrCmp $7 $9 0 slownext
StrCmp${_TEXTFUNC_S} $7 $9 0 slownext
call:
Push $2
@ -810,19 +802,17 @@ TrimNewLines
Pop $0
FunctionEnd
!undef _TEXTFUNC_UN
!define _TEXTFUNC_UN
!verbose pop
!endif
!macroend
!macro ConfigRead
!ifndef ${_TEXTFUNC_UN}ConfigRead
!ifndef ${_TEXTFUNC_UN}ConfigRead${_TEXTFUNC_S}
!verbose push
!verbose ${_TEXTFUNC_VERBOSE}
!define ${_TEXTFUNC_UN}ConfigRead `!insertmacro ${_TEXTFUNC_UN}ConfigReadCall`
!define ${_TEXTFUNC_UN}ConfigRead${_TEXTFUNC_S} `!insertmacro ${_TEXTFUNC_UN}ConfigRead${_TEXTFUNC_S}Call`
Function ${_TEXTFUNC_UN}ConfigRead
Function ${_TEXTFUNC_UN}ConfigRead${_TEXTFUNC_S}
Exch $1
Exch
Exch $0
@ -835,24 +825,22 @@ TrimNewLines
FileOpen $2 $0 r
IfErrors error
StrLen $0 $1
StrCmp $0 0 error
StrCmp${_TEXTFUNC_S} $0 0 error
readnext:
FileRead $2 $3
IfErrors empty
IfErrors error
StrCpy $4 $3 $0
StrCmp $4 $1 0 readnext
StrCmp${_TEXTFUNC_S} $4 $1 0 readnext
StrCpy $0 $3 '' $0
StrCpy $4 $0 1 -1
StrCmp $4 '$\r' +2
StrCmp $4 '$\n' 0 close
StrCmp${_TEXTFUNC_S} $4 '$\r' +2
StrCmp${_TEXTFUNC_S} $4 '$\n' 0 close
StrCpy $0 $0 -1
goto -4
error:
SetErrors
empty:
StrCpy $0 ''
close:
@ -865,19 +853,17 @@ TrimNewLines
Exch $0
FunctionEnd
!undef _TEXTFUNC_UN
!define _TEXTFUNC_UN
!verbose pop
!endif
!macroend
!macro ConfigWrite
!ifndef ${_TEXTFUNC_UN}ConfigWrite
!ifndef ${_TEXTFUNC_UN}ConfigWrite${_TEXTFUNC_S}
!verbose push
!verbose ${_TEXTFUNC_VERBOSE}
!define ${_TEXTFUNC_UN}ConfigWrite `!insertmacro ${_TEXTFUNC_UN}ConfigWriteCall`
!define ${_TEXTFUNC_UN}ConfigWrite${_TEXTFUNC_S} `!insertmacro ${_TEXTFUNC_UN}ConfigWrite${_TEXTFUNC_S}Call`
Function ${_TEXTFUNC_UN}ConfigWrite
Function ${_TEXTFUNC_UN}ConfigWrite${_TEXTFUNC_S}
Exch $2
Exch
Exch $1
@ -896,7 +882,7 @@ TrimNewLines
IfErrors error
StrLen $0 $1
StrCmp $0 0 0 readnext
StrCmp${_TEXTFUNC_S} $0 0 0 readnext
StrCpy $0 ''
goto close
@ -904,20 +890,20 @@ TrimNewLines
FileRead $3 $4
IfErrors add
StrCpy $5 $4 $0
StrCmp $5 $1 0 readnext
StrCmp${_TEXTFUNC_S} $5 $1 0 readnext
StrCpy $5 0
IntOp $5 $5 - 1
StrCpy $6 $4 1 $5
StrCmp $6 '$\r' -2
StrCmp $6 '$\n' -3
StrCmp${_TEXTFUNC_S} $6 '$\r' -2
StrCmp${_TEXTFUNC_S} $6 '$\n' -3
StrCpy $6 $4
StrCmp $5 -1 +3
StrCmp${_TEXTFUNC_S} $5 -1 +3
IntOp $5 $5 + 1
StrCpy $6 $4 $5
StrCmp $2 '' change
StrCmp $6 '$1$2' 0 change
StrCmp${_TEXTFUNC_S} $2 '' change
StrCmp${_TEXTFUNC_S} $6 '$1$2' 0 change
StrCpy $0 SAME
goto close
@ -933,26 +919,26 @@ TrimNewLines
FileSeek $3 $5 SET
System::Call 'kernel32::ReadFile(i r3, i r0, i $6, t.,)'
FileSeek $3 $4 SET
StrCmp $2 '' +2
StrCmp${_TEXTFUNC_S} $2 '' +2
FileWrite $3 '$1$2$\r$\n'
System::Call 'kernel32::WriteFile(i r3, i r0, i $6, t.,)'
System::Call 'kernel32::SetEndOfFile(i r3)'
System::Free $0
StrCmp $2 '' +3
StrCmp${_TEXTFUNC_S} $2 '' +3
StrCpy $0 CHANGED
goto close
StrCpy $0 DELETED
goto close
add:
StrCmp $2 '' 0 +3
StrCmp${_TEXTFUNC_S} $2 '' 0 +3
StrCpy $0 SAME
goto close
FileSeek $3 -1 END
FileRead $3 $4
IfErrors +4
StrCmp $4 '$\r' +3
StrCmp $4 '$\n' +2
StrCmp${_TEXTFUNC_S} $4 '$\r' +3
StrCmp${_TEXTFUNC_S} $4 '$\n' +2
FileWrite $3 '$\r$\n'
FileWrite $3 '$1$2$\r$\n'
StrCpy $0 ADDED
@ -975,8 +961,6 @@ TrimNewLines
Exch $0
FunctionEnd
!undef _TEXTFUNC_UN
!define _TEXTFUNC_UN
!verbose pop
!endif
!macroend
@ -1026,8 +1010,6 @@ TrimNewLines
Pop $0
FunctionEnd
!undef _TEXTFUNC_UN
!define _TEXTFUNC_UN
!verbose pop
!endif
!macroend
@ -1057,12 +1039,13 @@ TrimNewLines
Exch $0
FunctionEnd
!undef _TEXTFUNC_UN
!define _TEXTFUNC_UN
!verbose pop
!endif
!macroend
# Uninstall. Case insensitive. #
!macro un.LineFindCall _INPUT _OUTPUT _RANGE _FUNC
!verbose push
!verbose ${_TEXTFUNC_VERBOSE}
@ -1180,6 +1163,8 @@ TrimNewLines
!insertmacro LineFind
!undef _TEXTFUNC_UN
!define _TEXTFUNC_UN
!verbose pop
!endif
!macroend
@ -1193,6 +1178,8 @@ TrimNewLines
!insertmacro LineRead
!undef _TEXTFUNC_UN
!define _TEXTFUNC_UN
!verbose pop
!endif
!macroend
@ -1206,6 +1193,8 @@ TrimNewLines
!insertmacro FileReadFromEnd
!undef _TEXTFUNC_UN
!define _TEXTFUNC_UN
!verbose pop
!endif
!macroend
@ -1219,6 +1208,8 @@ TrimNewLines
!insertmacro LineSum
!undef _TEXTFUNC_UN
!define _TEXTFUNC_UN
!verbose pop
!endif
!macroend
@ -1232,6 +1223,8 @@ TrimNewLines
!insertmacro FileJoin
!undef _TEXTFUNC_UN
!define _TEXTFUNC_UN
!verbose pop
!endif
!macroend
@ -1245,6 +1238,8 @@ TrimNewLines
!insertmacro TextCompare
!undef _TEXTFUNC_UN
!define _TEXTFUNC_UN
!verbose pop
!endif
!macroend
@ -1258,6 +1253,8 @@ TrimNewLines
!insertmacro ConfigRead
!undef _TEXTFUNC_UN
!define _TEXTFUNC_UN
!verbose pop
!endif
!macroend
@ -1271,6 +1268,8 @@ TrimNewLines
!insertmacro ConfigWrite
!undef _TEXTFUNC_UN
!define _TEXTFUNC_UN
!verbose pop
!endif
!macroend
@ -1284,6 +1283,8 @@ TrimNewLines
!insertmacro FileRecode
!undef _TEXTFUNC_UN
!define _TEXTFUNC_UN
!verbose pop
!endif
!macroend
@ -1297,6 +1298,186 @@ TrimNewLines
!insertmacro TrimNewLines
!undef _TEXTFUNC_UN
!define _TEXTFUNC_UN
!verbose pop
!endif
!macroend
# Install. Case sensitive. #
!macro TextCompareSCall _FILE1 _FILE2 _OPTION _FUNC
!verbose push
!verbose ${_TEXTFUNC_VERBOSE}
Push $0
Push `${_FILE1}`
Push `${_FILE2}`
Push `${_OPTION}`
GetFunctionAddress $0 `${_FUNC}`
Push `$0`
Call TextCompareS
Pop $0
!verbose pop
!macroend
!macro ConfigReadSCall _FILE _ENTRY _RESULT
!verbose push
!verbose ${_TEXTFUNC_VERBOSE}
Push `${_FILE}`
Push `${_ENTRY}`
Call ConfigReadS
Pop ${_RESULT}
!verbose pop
!macroend
!macro ConfigWriteSCall _FILE _ENTRY _VALUE _RESULT
!verbose push
!verbose ${_TEXTFUNC_VERBOSE}
Push `${_FILE}`
Push `${_ENTRY}`
Push `${_VALUE}`
Call ConfigWriteS
Pop ${_RESULT}
!verbose pop
!macroend
!macro TextCompareS
!ifndef TextCompareS
!verbose push
!verbose ${_TEXTFUNC_VERBOSE}
!undef _TEXTFUNC_S
!define _TEXTFUNC_S `S`
!insertmacro TextCompare
!undef _TEXTFUNC_S
!define _TEXTFUNC_S
!verbose pop
!endif
!macroend
!macro ConfigReadS
!ifndef ConfigReadS
!verbose push
!verbose ${_TEXTFUNC_VERBOSE}
!undef _TEXTFUNC_S
!define _TEXTFUNC_S `S`
!insertmacro ConfigRead
!undef _TEXTFUNC_S
!define _TEXTFUNC_S
!verbose pop
!endif
!macroend
!macro ConfigWriteS
!ifndef ConfigWriteS
!verbose push
!verbose ${_TEXTFUNC_VERBOSE}
!undef _TEXTFUNC_S
!define _TEXTFUNC_S `S`
!insertmacro ConfigWrite
!undef _TEXTFUNC_S
!define _TEXTFUNC_S
!verbose pop
!endif
!macroend
# Uninstall. Case sensitive. #
!macro un.TextCompareSCall _FILE1 _FILE2 _OPTION _FUNC
!verbose push
!verbose ${_TEXTFUNC_VERBOSE}
Push $0
Push `${_FILE1}`
Push `${_FILE2}`
Push `${_OPTION}`
GetFunctionAddress $0 `${_FUNC}`
Push `$0`
Call un.TextCompareS
Pop $0
!verbose pop
!macroend
!macro un.ConfigReadSCall _FILE _ENTRY _RESULT
!verbose push
!verbose ${_TEXTFUNC_VERBOSE}
Push `${_FILE}`
Push `${_ENTRY}`
Call un.ConfigReadS
Pop ${_RESULT}
!verbose pop
!macroend
!macro un.ConfigWriteSCall _FILE _ENTRY _VALUE _RESULT
!verbose push
!verbose ${_TEXTFUNC_VERBOSE}
Push `${_FILE}`
Push `${_ENTRY}`
Push `${_VALUE}`
Call un.ConfigWriteS
Pop ${_RESULT}
!verbose pop
!macroend
!macro un.TextCompareS
!ifndef un.TextCompareS
!verbose push
!verbose ${_TEXTFUNC_VERBOSE}
!undef _TEXTFUNC_UN
!define _TEXTFUNC_UN `un.`
!undef _TEXTFUNC_S
!define _TEXTFUNC_S `S`
!insertmacro TextCompare
!undef _TEXTFUNC_UN
!define _TEXTFUNC_UN
!undef _TEXTFUNC_S
!define _TEXTFUNC_S
!verbose pop
!endif
!macroend
!macro un.ConfigReadS
!ifndef un.ConfigReadS
!verbose push
!verbose ${_TEXTFUNC_VERBOSE}
!undef _TEXTFUNC_UN
!define _TEXTFUNC_UN `un.`
!undef _TEXTFUNC_S
!define _TEXTFUNC_S `S`
!insertmacro ConfigRead
!undef _TEXTFUNC_UN
!define _TEXTFUNC_UN
!undef _TEXTFUNC_S
!define _TEXTFUNC_S
!verbose pop
!endif
!macroend
!macro un.ConfigWriteS
!ifndef un.ConfigWriteS
!verbose push
!verbose ${_TEXTFUNC_VERBOSE}
!undef _TEXTFUNC_UN
!define _TEXTFUNC_UN `un.`
!undef _TEXTFUNC_S
!define _TEXTFUNC_S `S`
!insertmacro ConfigWrite
!undef _TEXTFUNC_UN
!define _TEXTFUNC_UN
!undef _TEXTFUNC_S
!define _TEXTFUNC_S
!verbose pop
!endif
!macroend

File diff suppressed because it is too large Load diff