Statistiques
| Révision :

root / tmp / org.txm.setups / nsis-2.5 / Include / InstallOptions.nsh @ 3100

Historique | Voir | Annoter | Télécharger (4,56 ko)

1 2961 mdecorde
/*
2 2961 mdecorde
3 2961 mdecorde
InstallOptions.nsh
4 2961 mdecorde
Macros and conversion functions for InstallOptions
5 2961 mdecorde
6 2961 mdecorde
*/
7 2961 mdecorde
8 2961 mdecorde
!ifndef ___NSIS__INSTALL_OPTIONS__NSH___
9 2961 mdecorde
!define ___NSIS__INSTALL_OPTIONS__NSH___
10 2961 mdecorde
11 2961 mdecorde
!include LogicLib.nsh
12 2961 mdecorde
13 2961 mdecorde
!macro INSTALLOPTIONS_FUNCTION_READ_CONVERT
14 2961 mdecorde
  !insertmacro INSTALLOPTIONS_FUNCTION_IO2NSIS ""
15 2961 mdecorde
!macroend
16 2961 mdecorde
17 2961 mdecorde
!macro INSTALLOPTIONS_UNFUNCTION_READ_CONVERT
18 2961 mdecorde
  !insertmacro INSTALLOPTIONS_FUNCTION_IO2NSIS un.
19 2961 mdecorde
!macroend
20 2961 mdecorde
21 2961 mdecorde
!macro INSTALLOPTIONS_FUNCTION_WRITE_CONVERT
22 2961 mdecorde
  !insertmacro INSTALLOPTIONS_FUNCTION_NSIS2IO ""
23 2961 mdecorde
!macroend
24 2961 mdecorde
25 2961 mdecorde
!macro INSTALLOPTIONS_UNFUNCTION_WRITE_CONVERT
26 2961 mdecorde
  !insertmacro INSTALLOPTIONS_FUNCTION_NSIS2IO un.
27 2961 mdecorde
!macroend
28 2961 mdecorde
29 2961 mdecorde
!macro INSTALLOPTIONS_FUNCTION_NSIS2IO UNINSTALLER_FUNCPREFIX
30 2961 mdecorde
31 2961 mdecorde
  ; Convert an NSIS string to a form suitable for use by InstallOptions
32 2961 mdecorde
  ; Usage:
33 2961 mdecorde
  ;   Push <NSIS-string>
34 2961 mdecorde
  ;   Call Nsis2Io
35 2961 mdecorde
  ;   Pop <IO-string>
36 2961 mdecorde
37 2961 mdecorde
  Function ${UNINSTALLER_FUNCPREFIX}Nsis2Io
38 2961 mdecorde
39 2961 mdecorde
    Exch $0 ; The source
40 2961 mdecorde
    Push $1 ; The output
41 2961 mdecorde
    Push $2 ; Temporary char
42 2961 mdecorde
    Push $3 ; Length
43 2961 mdecorde
    Push $4 ; Loop index
44 2961 mdecorde
    StrCpy $1 "" ; Initialise the output
45 2961 mdecorde
46 2961 mdecorde
    StrLen $3 $0
47 2961 mdecorde
    IntOp $3 $3 - 1
48 2961 mdecorde
49 2961 mdecorde
    ${For} $4 0 $3
50 2961 mdecorde
      StrCpy $2 $0 1 $4
51 2961 mdecorde
      ${If}     $2 == '\'
52 2961 mdecorde
        StrCpy $2 '\\'
53 2961 mdecorde
      ${ElseIf} $2 == '$\r'
54 2961 mdecorde
        StrCpy $2 '\r'
55 2961 mdecorde
      ${ElseIf} $2 == '$\n'
56 2961 mdecorde
        StrCpy $2 '\n'
57 2961 mdecorde
      ${ElseIf} $2 == '$\t'
58 2961 mdecorde
        StrCpy $2 '\t'
59 2961 mdecorde
      ${EndIf}
60 2961 mdecorde
      StrCpy $1 $1$2
61 2961 mdecorde
    ${Next}
62 2961 mdecorde
63 2961 mdecorde
    StrCpy $0 $1
64 2961 mdecorde
    Pop $4
65 2961 mdecorde
    Pop $3
66 2961 mdecorde
    Pop $2
67 2961 mdecorde
    Pop $1
68 2961 mdecorde
    Exch $0
69 2961 mdecorde
70 2961 mdecorde
  FunctionEnd
71 2961 mdecorde
72 2961 mdecorde
!macroend
73 2961 mdecorde
74 2961 mdecorde
!macro INSTALLOPTIONS_FUNCTION_IO2NSIS UNINSTALLER_FUNCPREFIX
75 2961 mdecorde
76 2961 mdecorde
  ; Convert an InstallOptions string to a form suitable for use by NSIS
77 2961 mdecorde
  ; Usage:
78 2961 mdecorde
  ;   Push <IO-string>
79 2961 mdecorde
  ;   Call Io2Nsis
80 2961 mdecorde
  ;   Pop <NSIS-string>
81 2961 mdecorde
82 2961 mdecorde
  Function ${UNINSTALLER_FUNCPREFIX}Io2Nsis
83 2961 mdecorde
84 2961 mdecorde
    Exch $0 ; The source
85 2961 mdecorde
    Push $1 ; The output
86 2961 mdecorde
    Push $2 ; Temporary char
87 2961 mdecorde
    Push $3 ; Length
88 2961 mdecorde
    Push $4 ; Loop index
89 2961 mdecorde
    StrCpy $1 "" ; Initialise the output
90 2961 mdecorde
91 2961 mdecorde
    StrLen $3 $0
92 2961 mdecorde
    IntOp $3 $3 - 1
93 2961 mdecorde
94 2961 mdecorde
    ${For} $4 0 $3
95 2961 mdecorde
      StrCpy $2 $0 2 $4
96 2961 mdecorde
      ${If}     $2 == '\\'
97 2961 mdecorde
        StrCpy $2 '\'
98 2961 mdecorde
        IntOp $4 $4 + 1
99 2961 mdecorde
      ${ElseIf} $2 == '\r'
100 2961 mdecorde
        StrCpy $2 '$\r'
101 2961 mdecorde
        IntOp $4 $4 + 1
102 2961 mdecorde
      ${ElseIf} $2 == '\n'
103 2961 mdecorde
        StrCpy $2 '$\n'
104 2961 mdecorde
        IntOp $4 $4 + 1
105 2961 mdecorde
      ${ElseIf} $2 == '\t'
106 2961 mdecorde
        StrCpy $2 '$\t'
107 2961 mdecorde
        IntOp $4 $4 + 1
108 2961 mdecorde
      ${EndIf}
109 2961 mdecorde
      StrCpy $2 $2 1
110 2961 mdecorde
      StrCpy $1 $1$2
111 2961 mdecorde
    ${Next}
112 2961 mdecorde
113 2961 mdecorde
    StrCpy $0 $1
114 2961 mdecorde
    Pop $4
115 2961 mdecorde
    Pop $3
116 2961 mdecorde
    Pop $2
117 2961 mdecorde
    Pop $1
118 2961 mdecorde
    Exch $0
119 2961 mdecorde
120 2961 mdecorde
  FunctionEnd
121 2961 mdecorde
122 2961 mdecorde
!macroend
123 2961 mdecorde
124 2961 mdecorde
!macro INSTALLOPTIONS_EXTRACT FILE
125 2961 mdecorde
126 2961 mdecorde
  InitPluginsDir
127 2961 mdecorde
  File "/oname=$PLUGINSDIR\${FILE}" "${FILE}"
128 2961 mdecorde
  !insertmacro INSTALLOPTIONS_WRITE "${FILE}" "Settings" "RTL" "$(^RTL)"
129 2961 mdecorde
130 2961 mdecorde
  !verbose pop
131 2961 mdecorde
132 2961 mdecorde
!macroend
133 2961 mdecorde
134 2961 mdecorde
!macro INSTALLOPTIONS_EXTRACT_AS FILE FILENAME
135 2961 mdecorde
136 2961 mdecorde
  InitPluginsDir
137 2961 mdecorde
  File "/oname=$PLUGINSDIR\${FILENAME}" "${FILE}"
138 2961 mdecorde
  !insertmacro INSTALLOPTIONS_WRITE "${FILENAME}" "Settings" "RTL" "$(^RTL)"
139 2961 mdecorde
140 2961 mdecorde
!macroend
141 2961 mdecorde
142 2961 mdecorde
!macro INSTALLOPTIONS_DISPLAY FILE
143 2961 mdecorde
144 2961 mdecorde
  Push $0
145 2961 mdecorde
146 2961 mdecorde
  InstallOptions::dialog "$PLUGINSDIR\${FILE}"
147 2961 mdecorde
  Pop $0
148 2961 mdecorde
149 2961 mdecorde
  Pop $0
150 2961 mdecorde
151 2961 mdecorde
!macroend
152 2961 mdecorde
153 2961 mdecorde
!macro INSTALLOPTIONS_DISPLAY_RETURN FILE
154 2961 mdecorde
155 2961 mdecorde
  InstallOptions::dialog "$PLUGINSDIR\${FILE}"
156 2961 mdecorde
157 2961 mdecorde
!macroend
158 2961 mdecorde
159 2961 mdecorde
!macro INSTALLOPTIONS_INITDIALOG FILE
160 2961 mdecorde
161 2961 mdecorde
  InstallOptions::initDialog "$PLUGINSDIR\${FILE}"
162 2961 mdecorde
163 2961 mdecorde
!macroend
164 2961 mdecorde
165 2961 mdecorde
!macro INSTALLOPTIONS_SHOW
166 2961 mdecorde
167 2961 mdecorde
  Push $0
168 2961 mdecorde
169 2961 mdecorde
  InstallOptions::show
170 2961 mdecorde
  Pop $0
171 2961 mdecorde
172 2961 mdecorde
  Pop $0
173 2961 mdecorde
174 2961 mdecorde
!macroend
175 2961 mdecorde
176 2961 mdecorde
!macro INSTALLOPTIONS_SHOW_RETURN
177 2961 mdecorde
178 2961 mdecorde
  InstallOptions::show
179 2961 mdecorde
180 2961 mdecorde
!macroend
181 2961 mdecorde
182 2961 mdecorde
!macro INSTALLOPTIONS_READ VAR FILE SECTION KEY
183 2961 mdecorde
184 2961 mdecorde
  ReadIniStr ${VAR} "$PLUGINSDIR\${FILE}" "${SECTION}" "${KEY}"
185 2961 mdecorde
186 2961 mdecorde
!macroend
187 2961 mdecorde
188 2961 mdecorde
!macro INSTALLOPTIONS_WRITE FILE SECTION KEY VALUE
189 2961 mdecorde
190 2961 mdecorde
  WriteIniStr "$PLUGINSDIR\${FILE}" "${SECTION}" "${KEY}" "${VALUE}"
191 2961 mdecorde
192 2961 mdecorde
!macroend
193 2961 mdecorde
194 2961 mdecorde
!macro INSTALLOPTIONS_READ_CONVERT VAR FILE SECTION KEY
195 2961 mdecorde
196 2961 mdecorde
  ReadIniStr ${VAR} "$PLUGINSDIR\${FILE}" "${SECTION}" "${KEY}"
197 2961 mdecorde
  Push ${VAR}
198 2961 mdecorde
  Call Io2Nsis
199 2961 mdecorde
  Pop ${VAR}
200 2961 mdecorde
201 2961 mdecorde
!macroend
202 2961 mdecorde
203 2961 mdecorde
!macro INSTALLOPTIONS_READ_UNCONVERT VAR FILE SECTION KEY
204 2961 mdecorde
205 2961 mdecorde
  ReadIniStr ${VAR} "$PLUGINSDIR\${FILE}" "${SECTION}" "${KEY}"
206 2961 mdecorde
  Push ${VAR}
207 2961 mdecorde
  Call un.Io2Nsis
208 2961 mdecorde
  Pop ${VAR}
209 2961 mdecorde
210 2961 mdecorde
!macroend
211 2961 mdecorde
212 2961 mdecorde
!macro INSTALLOPTIONS_WRITE_CONVERT FILE SECTION KEY VALUE
213 2961 mdecorde
214 2961 mdecorde
  Push $0
215 2961 mdecorde
  StrCpy $0 "${VALUE}"
216 2961 mdecorde
  Push $0
217 2961 mdecorde
  Call Nsis2Io
218 2961 mdecorde
  Pop $0
219 2961 mdecorde
220 2961 mdecorde
  WriteIniStr "$PLUGINSDIR\${FILE}" "${SECTION}" "${KEY}" $0
221 2961 mdecorde
222 2961 mdecorde
  Pop $0
223 2961 mdecorde
224 2961 mdecorde
!macroend
225 2961 mdecorde
226 2961 mdecorde
!macro INSTALLOPTIONS_WRITE_UNCONVERT FILE SECTION KEY VALUE
227 2961 mdecorde
228 2961 mdecorde
  Push $0
229 2961 mdecorde
  StrCpy $0 "${VALUE}"
230 2961 mdecorde
  Push $0
231 2961 mdecorde
  Call un.Nsis2Io
232 2961 mdecorde
  Pop $0
233 2961 mdecorde
234 2961 mdecorde
  WriteIniStr "$PLUGINSDIR\${FILE}" "${SECTION}" "${KEY}" $0
235 2961 mdecorde
236 2961 mdecorde
  Pop $0
237 2961 mdecorde
238 2961 mdecorde
!macroend
239 2961 mdecorde
240 2961 mdecorde
!endif # ___NSIS__INSTALL_OPTIONS__NSH___