1 # sdcc.nsi - NSIS installer script for SDCC
3 # Copyright (c) 2003,2004 Borut Razem
5 # This file is part of sdcc.
7 # This software is provided 'as-is', without any express or implied
8 # warranty. In no event will the authors be held liable for any damages
9 # arising from the use of this software.
11 # Permission is granted to anyone to use this software for any purpose,
12 # including commercial applications, and to alter it and redistribute it
13 # freely, subject to the following restrictions:
15 # 1. The origin of this software must not be misrepresented; you must not
16 # claim that you wrote the original software. If you use this software
17 # in a product, an acknowledgment in the product documentation would be
18 # appreciated but is not required.
19 # 2. Altered source versions must be plainly marked as such, and must not be
20 # misrepresented as being the original software.
21 # 3. This notice may not be removed or altered from any source distribution.
24 # borut.razem@siol.net
26 # How to create WIN32 setup.exe
28 # - unpack WIN32 mingw daily snapshot sdcc-snapshot-i586-mingw32msvc-yyyymmdd.zip
29 # to a clean directory (the option to create directories should be enambled).
30 # A sub directory sdcc is created (referenced as PKGDIR in continuation).
31 # - copy files sdcc/support/scripts/sdcc.ico and sdcc/support/scripts/sdcc.nsi
32 # (this file) from the sdcc CVS snapshot to the PKGDIR directory
33 # - copy file COPYING from the sdcc CVS snapshot to the PKGDIR directory,
34 # rename it to COPYING.TXT and convert file COPYING to DOS format:
35 # unix2dos COPYING.TXT
36 # - run NSIS installer from PKGDIR directory:
37 # "c:\Program Files\NSIS\makensis.exe" sdcc.nsi
38 # - A setup file setup.exe is created in PKGDIR directory.
39 # Rename it to sdcc_yyyymmdd_setup.exe and upload it
40 # to sdcc download repository at sourceforge.net
43 # How to upload secc setup.exe tosourceforge.net
45 # Execute following commands from the cmd prompt:
46 # - sftp sdcc.sourceforge.net
47 # - cd /home/groups/s/sd/sdcc/htdocs/snapshots/i586-mingw32msvc-setup
48 # - put sdcc_yyyymmdd_setup.exe
61 !system "dir ${SDCC_ROOT}\device > NUL" <> 0
62 !define DEV_ROOT "${SDCC_ROOT}"
64 !system "dir ${SDCC_ROOT}\device > NUL" = 0
65 !define DEV_ROOT "${SDCC_ROOT}\device"
68 !system "unix2dos ${SDCC_ROOT}\doc\ChangeLog_head.txt" = 0
69 !system "unix2dos ${SDCC_ROOT}\doc\README.TXT" = 0
71 InstType "Full (Bin, Doc, Lib, Src)"
72 InstType "Medium (Bin, Doc, Lib)"
73 InstType "Compact (Bin, Doc)"
75 ;--------------------------------
78 Var MUI_STARTMENUPAGE_VARIABLE
80 ;--------------------------------
81 !define MUI_ABORTWARNING
83 !insertmacro MUI_PAGE_WELCOME
84 !insertmacro MUI_PAGE_LICENSE "${SDCC_ROOT}\COPYING.TXT"
85 !define MUI_STARTMENUPAGE_DEFAULTFOLDER "SDCC"
86 !define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
87 !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\SDCC"
88 !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "NSIS:StartMenuDir"
89 !define MUI_STARTMENUPAGE_NODISABLE
90 !insertmacro MUI_PAGE_STARTMENU Application $MUI_STARTMENUPAGE_VARIABLE
91 !insertmacro MUI_PAGE_COMPONENTS
92 !insertmacro MUI_PAGE_DIRECTORY
93 !insertmacro MUI_PAGE_INSTFILES
94 !insertmacro MUI_PAGE_FINISH
96 !insertmacro MUI_UNPAGE_INSTFILES
98 !insertmacro MUI_LANGUAGE "English"
103 InstallDir "$PROGRAMFILES\SDCC"
105 ShowUnInstDetails show
108 ;Uninstall the old version, if present
109 ReadRegStr $R0 HKLM \
110 "Software\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" \
114 MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
115 "$(^Name) is already installed. $\n$\nClick 'OK' to remove the \
116 previous version or 'Cancel' to cancel this upgrade." \
121 ; Run the uninstaller
123 ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file
125 ;IfErrors no_remove_uninstaller
126 ; ;You can either use Delete /REBOOTOK in the uninstaller or add some code
127 ; ;here to remove to remove the uninstaller. Use a registry key to check
128 ; ;whether the user has chosen to uninstall. If you are using an uninstaller
129 ; ;components page, make sure all sections are uninstalled.
130 ;no_remove_uninstaller:
135 ; Install the new version
136 MessageBox MB_YESNO|MB_ICONQUESTION "This will install $(^Name). Do you wish to continue?" IDYES +2
143 SetOutPath "$INSTDIR"
145 File "${SDCC_ROOT}\COPYING.TXT"
148 Section "SDCC application files"
150 SetOutPath "$INSTDIR\bin"
151 File "${SDCC_ROOT}\bin\*.exe"
154 Section "SDCC documentation"
156 SetOutPath "$INSTDIR\doc"
157 File "${SDCC_ROOT}\doc\ChangeLog_head.txt"
158 File "${SDCC_ROOT}\doc\README.TXT"
161 Section "SDCC include files"
163 SetOutPath "$INSTDIR\include\asm\default"
164 File "${DEV_ROOT}\include\asm\default\features.h"
165 SetOutPath "$INSTDIR\include\asm\gbz80"
166 File "${DEV_ROOT}\include\asm\gbz80\features.h"
167 SetOutPath "$INSTDIR\include\asm\z80"
168 File "${DEV_ROOT}\include\asm\z80\features.h"
169 SetOutPath "$INSTDIR\include"
170 File "${DEV_ROOT}\include\*.h"
173 Section "SDCC DS390 library"
175 SetOutPath "$INSTDIR\lib\ds390"
176 File "${DEV_ROOT}\lib\ds390\*.asm"
177 File "${DEV_ROOT}\lib\ds390\*.rel"
178 File "${DEV_ROOT}\lib\ds390\*.lib"
181 Section "SDCC DS400 library"
183 SetOutPath "$INSTDIR\lib\ds400"
184 File "${DEV_ROOT}\lib\ds400\*.asm"
185 File "${DEV_ROOT}\lib\ds400\*.rel"
186 File "${DEV_ROOT}\lib\ds400\*.lib"
189 Section "SDCC GBZ80 library"
191 SetOutPath "$INSTDIR\lib\gbz80"
192 File "${DEV_ROOT}\lib\gbz80\*.asm"
193 File "${DEV_ROOT}\lib\gbz80\*.o"
194 File "${DEV_ROOT}\lib\gbz80\*.lib"
197 Section "SDCC Z80 library"
199 SetOutPath "$INSTDIR\lib\z80"
200 File "${DEV_ROOT}\lib\z80\*.asm"
201 File "${DEV_ROOT}\lib\z80\*.o"
202 File "${DEV_ROOT}\lib\z80\*.lib"
205 Section "SDCC large model library"
207 SetOutPath "$INSTDIR\lib\large"
208 File "${DEV_ROOT}\lib\large\*.asm"
209 File "${DEV_ROOT}\lib\large\*.rel"
210 File "${DEV_ROOT}\lib\large\*.lib"
213 Section "SDCC small model library"
215 SetOutPath "$INSTDIR\lib\small"
216 File "${DEV_ROOT}\lib\small\*.asm"
217 File "${DEV_ROOT}\lib\small\*.rel"
218 File "${DEV_ROOT}\lib\small\*.lib"
221 Section "SDCC HC08 library"
223 SetOutPath "$INSTDIR\lib\hc08"
224 File "${DEV_ROOT}\lib\hc08\*.asm"
225 File "${DEV_ROOT}\lib\hc08\*.rel"
226 File "${DEV_ROOT}\lib\hc08\*.lib"
229 Section "SDCC library sources"
231 SetOutPath "$INSTDIR\lib\src\ds390\examples"
232 File "${DEV_ROOT}\lib\src\ds390\examples\MOVED"
234 SetOutPath "$INSTDIR\lib\src\ds390"
235 File "${DEV_ROOT}\lib\src\ds390\*.c"
236 File "${DEV_ROOT}\lib\src\ds390\libds390.lib"
237 File "${DEV_ROOT}\lib\src\ds390\Makefile"
238 File "${DEV_ROOT}\lib\src\ds390\Makefile.dep"
240 SetOutPath "$INSTDIR\lib\src\ds400"
241 File "${DEV_ROOT}\lib\src\ds400\*.c"
242 File "${DEV_ROOT}\lib\src\ds400\libds400.lib"
243 File "${DEV_ROOT}\lib\src\ds400\Makefile"
244 File "${DEV_ROOT}\lib\src\ds400\Makefile.dep"
246 SetOutPath "$INSTDIR\lib\src\gbz80"
247 File "${DEV_ROOT}\lib\src\gbz80\*.c"
248 File "${DEV_ROOT}\lib\src\gbz80\*.s"
249 File "${DEV_ROOT}\lib\src\gbz80\gbz80.lib"
250 File "${DEV_ROOT}\lib\src\gbz80\Makefile"
251 File "${DEV_ROOT}\lib\src\gbz80\README"
253 SetOutPath "$INSTDIR\lib\src\z80"
254 File "${DEV_ROOT}\lib\src\z80\*.c"
255 File "${DEV_ROOT}\lib\src\z80\*.s"
256 File "${DEV_ROOT}\lib\src\z80\Makefile"
257 File "${DEV_ROOT}\lib\src\z80\README"
258 File "${DEV_ROOT}\lib\src\z80\z80.lib"
260 SetOutPath "$INSTDIR\lib\src\hc08"
261 File "${DEV_ROOT}\lib\src\hc08\*.c"
262 File "${DEV_ROOT}\lib\src\hc08\Makefile"
263 File "${DEV_ROOT}\lib\src\hc08\hc08.lib"
265 SetOutPath "$INSTDIR\lib\src"
266 File "${DEV_ROOT}\lib\src\*.c"
270 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
271 CreateDirectory "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE"
272 CreateShortCut "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\SDCC on the Web.lnk" "$INSTDIR\sdcc.url"
273 CreateShortCut "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Uninstall SDCC.lnk" "$INSTDIR\uninstall.exe"
274 CreateShortCut "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Documentation.lnk" "$INSTDIR\doc\README.TXT" "" "$INSTDIR\sdcc.ico" "" "" "" ""
275 CreateShortCut "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Change Log.lnk" "$INSTDIR\doc\ChangeLog_head.txt" "" "$INSTDIR\sdcc.ico" "" "" "" ""
276 CreateShortCut "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\GPL 2 License.lnk" "$INSTDIR\COPYING.TXT"
277 !insertmacro MUI_STARTMENU_WRITE_END
281 WriteIniStr "$INSTDIR\sdcc.url" "InternetShortcut" "URL" "http://sdcc.sourceforge.net/"
285 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SDCC" "DisplayName" "SDCC"
286 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SDCC" "UninstallString" "$INSTDIR\uninstall.exe"
287 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SDCC" "Publisher" "sdcc.sourceforge.net"
288 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SDCC" "URLInfoAbout" "http://sdcc.sourceforge.net/"
289 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SDCC" "HelpLink" "http://sdcc.sourceforge.net/"
290 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SDCC" "URLUpdateInfo" "http://sdcc.sourceforge.net/"
291 WriteUninstaller "$INSTDIR\uninstall.exe"
295 MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Do you want to add $INSTDIR\bin to the PATH?" IDNO +3
301 ;;;; Uninstaller code ;;;;
304 MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
308 Function un.onUninstSuccess
310 MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
314 !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_STARTMENUPAGE_VARIABLE
316 Delete "$INSTDIR\sdcc.url"
318 DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SDCC" "NSIS:StartMenuDir"
319 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SDCC"
321 Delete "$INSTDIR\uninstall.exe"
322 Delete "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\GPL 2 License.lnk"
323 Delete "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Change Log.lnk"
324 Delete "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Documentation.lnk"
325 Delete "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Uninstall SDCC.lnk"
326 Delete "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\SDCC on the Web.lnk"
328 Delete "$INSTDIR\lib\src\hc08\*.c"
329 Delete "$INSTDIR\lib\src\hc08\hc08.lib"
330 Delete "$INSTDIR\lib\src\hc08\Makefile"
332 Delete "$INSTDIR\lib\src\z80\*.c"
333 Delete "$INSTDIR\lib\src\z80\*.s"
334 Delete "$INSTDIR\lib\src\z80\z80.lib"
335 Delete "$INSTDIR\lib\src\z80\README"
336 Delete "$INSTDIR\lib\src\z80\Makefile"
338 Delete "$INSTDIR\lib\src\gbz80\*.c"
339 Delete "$INSTDIR\lib\src\gbz80\*.s"
340 Delete "$INSTDIR\lib\src\gbz80\gbz80.lib"
341 Delete "$INSTDIR\lib\src\gbz80\README"
342 Delete "$INSTDIR\lib\src\gbz80\Makefile"
344 Delete "$INSTDIR\lib\src\ds390\*.c"
345 Delete "$INSTDIR\lib\src\ds390\libds390.lib"
346 Delete "$INSTDIR\lib\src\ds390\Makefile.dep"
347 Delete "$INSTDIR\lib\src\ds390\Makefile"
348 Delete "$INSTDIR\lib\src\ds390\examples\MOVED"
350 Delete "$INSTDIR\lib\src\ds400\*.c"
351 Delete "$INSTDIR\lib\src\ds400\libds400.lib"
352 Delete "$INSTDIR\lib\src\ds400\Makefile.dep"
353 Delete "$INSTDIR\lib\src\ds400\Makefile"
355 Delete "$INSTDIR\lib\src\*.c"
357 Delete "$INSTDIR\lib\hc08\*.rel"
358 Delete "$INSTDIR\lib\hc08\*.asm"
359 Delete "$INSTDIR\lib\hc08\*.lib"
361 Delete "$INSTDIR\lib\z80\*.o"
362 Delete "$INSTDIR\lib\z80\*.asm"
363 Delete "$INSTDIR\lib\z80\*.lib"
365 Delete "$INSTDIR\lib\small\*.asm"
366 Delete "$INSTDIR\lib\small\*.rel"
367 Delete "$INSTDIR\lib\small\*.lib"
369 Delete "$INSTDIR\lib\large\*.asm"
370 Delete "$INSTDIR\lib\large\*.rel"
371 Delete "$INSTDIR\lib\large\*.lib"
373 Delete "$INSTDIR\lib\gbz80\*.asm"
374 Delete "$INSTDIR\lib\gbz80\*.o"
375 Delete "$INSTDIR\lib\gbz80\*.lib"
377 Delete "$INSTDIR\lib\ds390\*.asm"
378 Delete "$INSTDIR\lib\ds390\*.rel"
379 Delete "$INSTDIR\lib\ds390\*.lib"
381 Delete "$INSTDIR\lib\ds400\*.asm"
382 Delete "$INSTDIR\lib\ds400\*.rel"
383 Delete "$INSTDIR\lib\ds400\*.lib"
385 Delete "$INSTDIR\include\asm\z80\*.h"
386 Delete "$INSTDIR\include\asm\gbz80\*.h"
387 Delete "$INSTDIR\include\asm\default\*.h"
388 Delete "$INSTDIR\include\*.h"
390 Delete "$INSTDIR\doc\README.TXT"
391 Delete "$INSTDIR\doc\ChangeLog_head.txt"
393 Delete "$INSTDIR\bin\*.exe"
395 Delete "$INSTDIR\COPYING.TXT"
396 Delete "$INSTDIR\sdcc.ico"
398 RMDir "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE"
400 RMDir "$INSTDIR\lib\src\z80"
401 RMDir "$INSTDIR\lib\src\gbz80"
402 RMDir "$INSTDIR\lib\src\ds390\examples"
403 RMDir "$INSTDIR\lib\src\ds390"
404 RMDir "$INSTDIR\lib\src\ds400"
405 RMDir "$INSTDIR\lib\src\hc08"
406 RMDir "$INSTDIR\lib\src"
408 RMDir "$INSTDIR\lib\z80"
409 RMDir "$INSTDIR\lib\small"
410 RMDir "$INSTDIR\lib\large"
411 RMDir "$INSTDIR\lib\gbz80"
412 RMDir "$INSTDIR\lib\ds390"
413 RMDir "$INSTDIR\lib\ds400"
414 RMDir "$INSTDIR\lib\hc08"
417 RMDir "$INSTDIR\include\asm\z80"
418 RMDir "$INSTDIR\include\asm\gbz80"
419 RMDir "$INSTDIR\include\asm\default"
420 RMDir "$INSTDIR\include\asm"
421 RMDir "$INSTDIR\include"
430 Call un.RemoveFromPath
435 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
436 ; Path Manipulation functions ;
437 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
440 !include "WinMessages.NSH"
443 ; AddToPath - Adds the given dir to the search path.
444 ; Input - head of the stack
445 ; Note - Win9x systems requires reboot
454 ; don't add if the path doesn't exist
455 IfFileExists $0 "" AddToPath_done
460 ; Not on NT: read PATH from environment variable
463 ; On NT: read PATH from registry
464 ReadRegStr $1 HKCU "Environment" "PATH"
469 StrCmp $2 "" "" AddToPath_done
474 StrCmp $2 "" "" AddToPath_done
475 GetFullPathName /SHORT $3 $0
480 StrCmp $2 "" "" AddToPath_done
485 StrCmp $2 "" "" AddToPath_done
487 StrCmp $4 1 AddToPath_NT
490 FileOpen $1 "$1\autoexec.bat" a
493 IntCmp $2 26 0 +2 +2 ; DOS EOF
494 FileSeek $1 -1 END ; write over EOF
495 FileWrite $1 "$\r$\nSET PATH=%PATH%;$3$\r$\n"
501 ReadRegStr $1 HKCU "Environment" "PATH"
502 StrCpy $2 $1 1 -1 ; copy last char
503 StrCmp $2 ";" 0 +2 ; if last char == ;
504 StrCpy $1 $1 -1 ; remove last char
505 StrCmp $1 "" AddToPath_NTdoIt
508 WriteRegExpandStr HKCU "Environment" "PATH" $0
509 SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
519 ; RemoveFromPath - Remove a given dir from the path
520 ; Input: head of the stack
522 Function un.RemoveFromPath
531 IntFmt $6 "%c" 26 ; DOS EOF
535 StrCmp $1 1 unRemoveFromPath_NT
538 FileOpen $1 "$1\autoexec.bat" r
541 GetFullPathName /SHORT $0 $0
542 StrCpy $0 "SET PATH=%PATH%;$0"
543 Goto unRemoveFromPath_dosLoop
545 unRemoveFromPath_dosLoop:
547 StrCpy $5 $3 1 -1 ; read last char
548 StrCmp $5 $6 0 +2 ; if DOS EOF
549 StrCpy $3 $3 -1 ; remove DOS EOF so we can compare
550 StrCmp $3 "$0$\r$\n" unRemoveFromPath_dosLoopRemoveLine
551 StrCmp $3 "$0$\n" unRemoveFromPath_dosLoopRemoveLine
552 StrCmp $3 "$0" unRemoveFromPath_dosLoopRemoveLine
553 StrCmp $3 "" unRemoveFromPath_dosLoopEnd
555 Goto unRemoveFromPath_dosLoop
556 unRemoveFromPath_dosLoopRemoveLine:
558 Goto unRemoveFromPath_dosLoop
560 unRemoveFromPath_dosLoopEnd:
564 Delete "$1\autoexec.bat"
565 CopyFiles /SILENT $4 "$1\autoexec.bat"
567 Goto unRemoveFromPath_done
570 ReadRegStr $1 HKCU "Environment" "PATH"
571 StrCpy $5 $1 1 -1 ; copy last char
572 StrCmp $5 ";" +2 ; if last char != ;
573 StrCpy $1 "$1;" ; append ;
576 Call un.StrStr ; Find `$0;` in $1
577 Pop $2 ; pos of our dir
578 StrCmp $2 "" unRemoveFromPath_done
579 ; else, it is in path
584 StrCpy $5 $1 -$4 ; $5 is now the part before the path to remove
585 StrCpy $6 $2 "" $3 ; $6 is now the part after the path to remove
588 StrCpy $5 $3 1 -1 ; copy last char
589 StrCmp $5 ";" 0 +2 ; if last char == ;
590 StrCpy $3 $3 -1 ; remove last char
593 ; New PATH not empty: update the registry
594 WriteRegExpandStr HKCU "Environment" "PATH" $3
596 ; New PATH empty: remove from the registry
597 DeleteRegValue HKCU "Environment" "PATH"
598 SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
600 unRemoveFromPath_done:
610 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
611 ; Utility Functions ;
612 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
616 ; output, top of the stack = 1 if NT or 0 if not
621 ; ($R0 at this point is 1 or 0)
626 ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
627 StrCmp $0 "" 0 IsNT_yes
640 !insertmacro IsNT "un."
643 ; input, top of stack = string to search for
644 ; top of stack-1 = string to search in
645 ; output, top of stack (replaces with the portion of the string remaining)
646 ; modifies no other variables.
649 ; Push "this is a long ass string"
653 ; ($R0 at this point is "ass string")
657 Exch $R1 ; st=haystack,old$R1, $R1=needle
658 Exch ; st=old$R1,haystack
659 Exch $R2 ; st=old$R1,old$R2, $R2=haystack
671 StrCpy $R5 $R2 $R3 $R4
677 StrCpy $R1 $R2 "" $R4
685 !insertmacro StrStr ""
686 !insertmacro StrStr "un."