This commit was generated by cvs2svn to compensate for changes in r2,
which included commits to RCS files with non-trunk default branches. git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@625 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
9b3b220a13
commit
3e9e73ec59
177 changed files with 37677 additions and 0 deletions
48
Examples/primes.nsi
Normal file
48
Examples/primes.nsi
Normal file
|
@ -0,0 +1,48 @@
|
|||
Name "primes"
|
||||
AllowRootDirInstall true
|
||||
OutFile "primes.exe"
|
||||
Caption "Prime number generator"
|
||||
ShowInstDetails show
|
||||
AllowRootDirInstall true
|
||||
InstallDir "$EXEDIR"
|
||||
DirText "Select directory to write primes.txt"
|
||||
|
||||
Section "crap"
|
||||
SetOutPath $INSTDIR
|
||||
Call DoPrimes
|
||||
SectionEnd
|
||||
|
||||
Function DoPrimes
|
||||
; we put this in here so it doesn't update the progress bar (faster)
|
||||
!define PPOS $0 ; position in prime searching
|
||||
!define PDIV $1 ; divisor
|
||||
!define PMOD $2 ; the result of the modulus
|
||||
!define PCNT $3 ; count of how many we've printed
|
||||
FileOpen $9 $INSTDIR\primes.txt w
|
||||
|
||||
DetailPrint "2 is prime!"
|
||||
FileWrite $9 "2 is prime!$\r$\n"
|
||||
DetailPrint "3 is prime!"
|
||||
FileWrite $9 "3 is prime!$\r$\n"
|
||||
Strcpy ${PPOS} 3
|
||||
Strcpy ${PCNT} 2
|
||||
outerloop:
|
||||
StrCpy ${PDIV} 3
|
||||
innerloop:
|
||||
IntOp ${PMOD} ${PPOS} % ${PDIV}
|
||||
IntCmp ${PMOD} 0 notprime
|
||||
IntOp ${PDIV} ${PDIV} + 2
|
||||
IntCmp ${PDIV} ${PPOS} 0 innerloop 0
|
||||
DetailPrint "${PPOS} is prime!"
|
||||
FileWrite $9 "${PPOS} is prime!$\r$\n"
|
||||
IntOp ${PCNT} ${PCNT} + 1
|
||||
IntCmp ${PCNT} 100 0 innerloop
|
||||
StrCpy ${PCNT} 0
|
||||
MessageBox MB_YESNO "Process more?" IDNO stop
|
||||
notprime:
|
||||
IntOp ${PPOS} ${PPOS} + 2
|
||||
Goto outerloop
|
||||
stop:
|
||||
FileClose $9
|
||||
FunctionEnd
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue