Skip to content

Commit

Permalink
Version 2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
niclaslindstedt committed Oct 13, 2013
1 parent 240ef7d commit 3b2405f
Show file tree
Hide file tree
Showing 12 changed files with 115 additions and 3,918 deletions.
2,441 changes: 0 additions & 2,441 deletions Include/FileFunc.nsh

This file was deleted.

748 changes: 0 additions & 748 deletions Include/LogicLib.nsh

This file was deleted.

1 change: 0 additions & 1 deletion Include/MUI.nsh

This file was deleted.

48 changes: 0 additions & 48 deletions Include/StrContains.nsh

This file was deleted.

62 changes: 62 additions & 0 deletions Include/StrStr.nsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
!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
${Do}
;Remove everything before and after the searched part ("TempStr")
StrCpy $R5 $R1 $R2 $R4

;Compare "TempStr" with "SubString"
${IfThen} $R5 == $R0 ${|} ${ExitDo} ${|}
;If not "SubString", this could be "String"'s end
${IfThen} $R4 >= $R3 ${|} ${ExitDo} ${|}
;If not, continue the loop
IntOp $R4 $R4 + 1
${Loop}

/*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
Loading

0 comments on commit 3b2405f

Please sign in to comment.