diff options
author | Chris Johns <chrisj@rtems.org> | 2007-08-20 02:12:48 +0000 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2007-08-20 02:12:48 +0000 |
commit | 598aab1fe570501e585539ccf30c26450d0b1088 (patch) | |
tree | ba34ec03f23d8c89672f06aee8b89c3db5e0bbe1 /contrib/mingw/strstr.nsi | |
parent | Spacing. (diff) | |
download | rtems-598aab1fe570501e585539ccf30c26450d0b1088.tar.bz2 |
2007-08-20 Chris Johns <chisj@rtems.org>
* filewrite.nsi, getparameters.nsi, instance-check.nsi,
mingw-path.nsi, sm-dummy.nsi, strslash.nsi, strstr.nsi,
options.nsi: Added the shared between the 2 installer scripts.
* msys-path.nsi: Fixed the last LF bug.
* rtems-autotools.nsi, rtems-tools.nsi: Fixed the instance check,
added a start menu, remove pages from target installers.
* rtems.ini: Fixed the URL links. Added support link.
* rtems_logo.bmp: Trimmed a little more to get a better image.
* ba-wrap.sh: Stop on a error.
* build-exes.sh: Use the option parameter variables. Change the
order the section appear in the installer.
Diffstat (limited to '')
-rw-r--r-- | contrib/mingw/strstr.nsi | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/contrib/mingw/strstr.nsi b/contrib/mingw/strstr.nsi new file mode 100644 index 0000000000..22c4f68c5b --- /dev/null +++ b/contrib/mingw/strstr.nsi @@ -0,0 +1,63 @@ +!define StrStr "!insertmacro StrStr" + +!macro StrStr ResultVar String SubString + Push `${String}` + Push `${SubString}` + Call StrStr + Pop `${ResultVar}` +!macroend + +Function StrStr +/*After this point: + ------------------------------------------ + $R0 = SubString (input) + $R1 = String (input) + $R2 = SubStringLen (temp) + $R3 = StrLen (temp) + $R4 = StartCharPos (temp) + $R5 = TempStr (temp)*/ + + ;Get input from user + Exch $R0 + Exch + Exch $R1 + Push $R2 + Push $R3 + Push $R4 + Push $R5 + + ;Get "String" and "SubString" length + StrLen $R2 $R0 + StrLen $R3 $R1 + ;Start "StartCharPos" counter + StrCpy $R4 0 + + ;Loop until "SubString" is found or "String" reaches its end + loop: + ;Remove everything before and after the searched part ("TempStr") + StrCpy $R5 $R1 $R2 $R4 + + ;Compare "TempStr" with "SubString" + StrCmp $R5 $R0 done + ;If not "SubString", this could be "String"'s end + IntCmp $R4 $R3 done 0 done + ;If not, continue the loop + IntOp $R4 $R4 + 1 + Goto loop + done: + +/*After this point: + ------------------------------------------ + $R0 = ResultVar (output)*/ + + ;Remove part before "SubString" on "String" (if there has one) + StrCpy $R0 $R1 `` $R4 + + ;Return output to user + Pop $R5 + Pop $R4 + Pop $R3 + Pop $R2 + Pop $R1 + Exch $R0 +FunctionEnd |