Mercurial > pidgin
annotate src/win32/nsis/gaim-plugin.nsh @ 11971:cc7146eee26f
[gaim-migrate @ 14264]
I took a stab at getting Novell working. Coding stuff without
being able to test it is scary.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Fri, 04 Nov 2005 07:37:10 +0000 |
parents | 8b955ffe9584 |
children |
rev | line source |
---|---|
11578
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
1 ;; |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
2 ;; Windows Gaim NSIS installer plugin helper utilities |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
3 ;; Copyright 2005, Daniel Atallah <daniel_atallah@yahoo.com> |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
4 ;; |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
5 ;; Include in plugin installer scripts using: |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
6 ;; !addincludedir "${PATH_TO_GAIM_SRC}\src\win32\nsis" |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
7 ;; !include "gaim-plugin.nsh" |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
8 ;; |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
9 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
10 !define GAIM_REG_KEY "SOFTWARE\gaim" |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
11 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
12 !define GAIM_VERSION_OK 0 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
13 !define GAIM_VERSION_INCOMPATIBLE 1 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
14 !define GAIM_VERSION_UNDEFINED 2 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
15 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
16 ; Extract the Gaim Version from the registry |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
17 ; This will set the Error flag if unable to determine the value |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
18 ; Pop the value of the stack after calling this to get the value (unless Error Flag is set) |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
19 Function GetGaimVersion |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
20 Push $R0 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
21 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
22 ; Read the gaim version |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
23 ClearErrors |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
24 ReadRegStr $R0 HKLM ${GAIM_REG_KEY} "Version" |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
25 IfErrors +1 GetGaimVersion_found |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
26 ; fall back to the HKCU registry key |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
27 ReadRegStr $R0 HKCU ${GAIM_REG_KEY} "Version" |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
28 IfErrors GetGaimVersion_done ; Keep the error flag set |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
29 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
30 GetGaimVersion_found: |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
31 Push $R0 ; Push the value onto the stack |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
32 Exch |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
33 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
34 GetGaimVersion_done: |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
35 ; restore $R0 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
36 Pop $R0 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
37 FunctionEnd |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
38 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
39 ; Check that the currently installed gaim version is compatible |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
40 ; with the plugin version we are installing |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
41 ; Push the Plugin's Gaim Version onto the Stack before calling |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
42 ; After calling, the top of the Stack will contain the result of the check: |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
43 ; GAIM_VERSION_OK - If the installed gaim version is compatible w/ the version specified |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
44 ; GAIM_VERSION_INCOMPATIBLE - If the installed gaim version isn't compatible w/ the ersion specified |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
45 ; GAIM_VERSION_UNDEFINED - If the installed gaim version can't be determined |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
46 Function CheckGaimVersion |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
47 ; Save the Variable values that we will use in the stack |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
48 Push $R4 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
49 Exch |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
50 Pop $R4 ; Get the plugin's Gaim Version |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
51 Push $R0 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
52 Push $R1 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
53 Push $R2 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
54 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
55 ; Read the gaim version |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
56 Call GetGaimVersion |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
57 IfErrors checkGaimVersion_noGaimInstallFound |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
58 Pop $R0 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
59 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
60 ;If they are exactly the same, we don't need to look at anything else |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
61 StrCmp $R0 $R4 checkGaimVersion_VersionOK |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
62 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
63 ; Versions are in the form of X.Y.Z |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
64 ; If X is different or plugin's Y > gaim's Y, then we shouldn't install |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
65 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
66 ;Check the Major Version |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
67 Push $R0 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
68 Push 0 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
69 Call GetVersionComponent |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
70 IfErrors checkGaimVersion_noGaimInstallFound ;We couldn't extract 'X' from the installed gaim version |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
71 Pop $R2 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
72 Push $R4 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
73 Push 0 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
74 Call GetVersionComponent |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
75 IfErrors checkGaimVersion_BadVersion ; this isn't a valid version, so don't bother even checking |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
76 Pop $R1 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
77 ;Check that both versions' X is the same |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
78 StrCmp $R1 $R2 +1 checkGaimVersion_BadVersion |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
79 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
80 ;Check the Minor Version |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
81 Push $R0 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
82 Push 1 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
83 Call GetVersionComponent |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
84 IfErrors checkGaimVersion_noGaimInstallFound ;We couldn't extract 'Y' from the installed gaim version |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
85 Pop $R2 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
86 Push $R4 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
87 Push 1 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
88 Call GetVersionComponent |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
89 IfErrors checkGaimVersion_BadVersion ; this isn't a valid version, so don't bother even checking |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
90 Pop $R1 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
91 ;Check that plugin's Y <= gaim's Y |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
92 IntCmp $R1 $R2 checkGaimVersion_VersionOK checkGaimVersion_VersionOK checkGaimVersion_BadVersion |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
93 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
94 checkGaimVersion_BadVersion: |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
95 Push ${GAIM_VERSION_INCOMPATIBLE} |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
96 goto checkGaimVersion_done |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
97 checkGaimVersion_noGaimInstallFound: |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
98 Push ${GAIM_VERSION_UNDEFINED} |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
99 goto checkGaimVersion_done |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
100 checkGaimVersion_VersionOK: |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
101 Push ${GAIM_VERSION_OK} |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
102 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
103 checkGaimVersion_done: |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
104 ; Restore the Variables that we used |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
105 Exch |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
106 Pop $R2 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
107 Exch |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
108 Pop $R1 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
109 Exch |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
110 Pop $R0 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
111 Exch |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
112 Pop $R4 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
113 FunctionEnd |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
114 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
115 ; Extract the part of a string prior to "." (or the whole string if there is no ".") |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
116 ; If no "." was found, the ErrorFlag will be set |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
117 ; Before this is called, Push ${VERSION_STRING} must be called, and then Push 0 for Major, 1 for Minor, etc |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
118 ; Pop should be called after to retrieve the new value |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
119 Function GetVersionComponent |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
120 ClearErrors |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
121 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
122 ; Save the Variable values that we will use in the stack |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
123 Push $1 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
124 Exch |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
125 Pop $1 ;The version component which we want to extract (0, 1, 2) |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
126 Exch |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
127 Push $0 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
128 Exch |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
129 Pop $0 ;The string from which to extract the version component |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
130 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
131 Push $2 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
132 Push $3 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
133 Push $4 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
134 Push $5 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
135 Push $6 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
136 Push $7 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
137 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
138 StrCpy $2 "0" ;Initialize our string index counter |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
139 StrCpy $7 "0" ;Index of last "." |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
140 StrCpy $3 "0" ;Initialize our version index counter |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
141 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
142 startGetVersionComponentLoop: |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
143 ;avoid infinite loop (if we have gotten the whole initial string, exit the loop and set the error flag) |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
144 StrCmp $6 $0 GetVersionComponentSetErrorFlag |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
145 IntOp $2 $2 + 1 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
146 StrCpy $6 $0 $2 ;Update the infinite loop preventing string |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
147 ;Determine the correct substring (only the current index component) |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
148 IntOp $5 $2 - $7 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
149 StrCpy $4 $0 $5 $7 ;Append the current character in $0 to $4 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
150 StrCpy $5 $0 1 $2 ;store the next character in $5 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
151 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
152 ;if the next character is ".", $4 will contain the version component prior to "." |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
153 StrCmp $5 "." +1 startGetVersionComponentLoop |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
154 StrCmp $3 $1 doneGetVersionComponent ;If it is the version component we're looking for, stop |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
155 IntOp $3 $3 + 1 ;Increment the version index counter |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
156 IntOp $2 $2 + 1 ;Increment the version string index to "." (so it will be skipped) |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
157 StrCpy $7 $2 ;Keep track of the index of the last "." |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
158 StrCpy $6 $0 $2 ;Update the infinite loop preventing string |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
159 goto startGetVersionComponentLoop |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
160 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
161 GetVersionComponentSetErrorFlag: |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
162 SetErrors |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
163 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
164 doneGetVersionComponent: |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
165 ; Restore the Variables that we used |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
166 Pop $7 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
167 Pop $6 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
168 Pop $5 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
169 Push $4 ;This is the value we're returning |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
170 Exch |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
171 Pop $4 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
172 Exch |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
173 Pop $3 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
174 Exch |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
175 Pop $2 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
176 Exch |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
177 Pop $0 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
178 Exch |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
179 Pop $1 |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
180 FunctionEnd |
8b955ffe9584
[gaim-migrate @ 13847]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
181 |