source: rtems/contrib/mingw/strstr.nsi @ 0e6d50c

4.104.114.95
Last change on this file since 0e6d50c was 598aab1f, checked in by Chris Johns <chrisj@…>, on Aug 20, 2007 at 2:12:48 AM

2007-08-20 Chris Johns <chisj@…>

  • 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.
  • Property mode set to 100644
File size: 1.3 KB
Line 
1!define StrStr "!insertmacro StrStr"
2 
3!macro StrStr ResultVar String SubString
4  Push `${String}`
5  Push `${SubString}`
6  Call StrStr
7  Pop `${ResultVar}`
8!macroend
9 
10Function StrStr
11/*After this point:
12  ------------------------------------------
13  $R0 = SubString (input)
14  $R1 = String (input)
15  $R2 = SubStringLen (temp)
16  $R3 = StrLen (temp)
17  $R4 = StartCharPos (temp)
18  $R5 = TempStr (temp)*/
19 
20  ;Get input from user
21  Exch $R0
22  Exch
23  Exch $R1
24  Push $R2
25  Push $R3
26  Push $R4
27  Push $R5
28 
29  ;Get "String" and "SubString" length
30  StrLen $R2 $R0
31  StrLen $R3 $R1
32  ;Start "StartCharPos" counter
33  StrCpy $R4 0
34 
35  ;Loop until "SubString" is found or "String" reaches its end
36  loop:
37    ;Remove everything before and after the searched part ("TempStr")
38    StrCpy $R5 $R1 $R2 $R4
39 
40    ;Compare "TempStr" with "SubString"
41    StrCmp $R5 $R0 done
42    ;If not "SubString", this could be "String"'s end
43    IntCmp $R4 $R3 done 0 done
44    ;If not, continue the loop
45    IntOp $R4 $R4 + 1
46    Goto loop
47  done:
48 
49/*After this point:
50  ------------------------------------------
51  $R0 = ResultVar (output)*/
52 
53  ;Remove part before "SubString" on "String" (if there has one)
54  StrCpy $R0 $R1 `` $R4
55 
56  ;Return output to user
57  Pop $R5
58  Pop $R4
59  Pop $R3
60  Pop $R2
61  Pop $R1
62  Exch $R0
63FunctionEnd
Note: See TracBrowser for help on using the repository browser.