Archive: Array class


Array class
${myArray->Exists} Value GotoIfExists GotoIfNotExists
and
${myArray->Destroy}
methods do not seem to compile
Here is my code in essence:
In Utils.nsh, I have these globals

## Array creation
${Array} arrayIndexNames
${Array} arrayIndexAttribs

then I have
Function InitUtils
${arrayIndexNames->Init}
${arrayIndexAttribs->Init}
FunctionEnd

The client of this class calls InitUtils() in
.onInit() call.

I wrote UninitUtils() which would call Destroy() and tried calling UninitUtils() from .onInstFailed(), .onInstSuccess() etc. I get compiler error


Please attach your complete script.

-Stu


...
File /oname=$PLUGINSDIR\w03b.pat texture\w03b.pat
vpatch::vpatchfile "$PLUGINSDIR\w03b.pat" "$INSTDIR\cdrom.img\stage\w03b\cache.qar" "$INSTDIR\cdrom.img\stage\w03b\cache.tmp"
Pop $R0
Strcmp $R0 "OK" 0 +3
Delete "$INSTDIR\cdrom.img\stage\w03b\cache.qar"
Rename "$INSTDIR\cdrom.img\stage\w03b\cache.tmp" "$INSTDIR\cdrom.img\stage\w03b\cache.qar"
File /oname=$PLUGINSDIR\w04a.pat texture\w04a.pat
vpatch::vpatchfile "$PLUGINSDIR\w04a.pat" "$INSTDIR\cdrom.img\stage\w04a\cache.qar" "$INSTDIR\cdrom.img\stage\w04a\cache.tmp"
Pop $R0
Strcmp $R0 "OK" 0 +3
Delete "$INSTDIR\cdrom.img\stage\w04a\cache.qar"
Rename "$INSTDIR\cdrom.img\stage\w04a\cache.tmp" "$INSTDIR\cdrom.img\stage\w04a\cache.qar"
File /oname=$PLUGINSDIR\w04b.pat texture\w04b.pat
vpatch::vpatchfile "$PLUGINSDIR\w04b.pat" "$INSTDIR\cdrom.img\stage\w04b\cache.qar" "$INSTDIR\cdrom.img\stage\w04b\cache.tmp"
Pop $R0
Strcmp $R0 "OK" 0 +3
Delete "$INSTDIR\cdrom.img\stage\w04b\cache.qar"
Rename "$INSTDIR\cdrom.img\stage\w04b\cache.tmp" "$INSTDIR\cdrom.img\stage\w04b\cache.qar"
File /oname=$PLUGINSDIR\w04c.pat texture\w04c.pat
vpatch::vpatchfile "$PLUGINSDIR\w04c.pat" "$INSTDIR\cdrom.img\stage\w04c\cache.qar" "$INSTDIR\cdrom.img\stage\w04c\cache.tmp"
Pop $R0
Strcmp $R0 "OK" 0 +3
Delete "$INSTDIR\cdrom.img\stage\w04c\cache.qar"
Rename "$INSTDIR\cdrom.img\stage\w04c\cache.tmp" "$INSTDIR\cdrom.img\stage\w04c\cache.qar"
...

How can I simplify this code? I make a try of array, but does't work. I don't understand, how work the array.

Just this scripts changed in the code: w03b, w04a, w04b, w04c

Thx


First, you could create a macro to simplify that (I don't know if it works, but you can get the idea...):


!macro Test FileName
File /oname=$PLUGINSDIR\${FileName}.pat \
texture\${FileName}.pat
vpatch::vpatchfile "$PLUGINSDIR\${FileName}.pat" \
"$INSTDIR\cdrom.img\stage\${FileName}\cache.qar" \
"$INSTDIR\cdrom.img\stage\${FileName}\cache.tmp"
Pop $R0
Strcmp $R0 "OK" 0 +3
Delete "$INSTDIR\cdrom.img\stage\${FileName}\cache.qar"
Rename "$INSTDIR\cdrom.img\stage\${FileName}\cache.tmp" \
"$INSTDIR\cdrom.img\stage\${FileName}\cache.qar"
!macroend

!insertmacro Test w03b
!insertmacro Test w04a
!insertmacro Test w04b
!insertmacro Test w04c


Second, I don't know much about arrays... =(

Hmm... good idea :) Thx
I try it.