/usr/share/doc/nsis/Docs/Chapter5.html is in nsis-doc 2.46-7.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<title>Compile Time Commands</title>
<meta name="generator" content="Halibut version 1.0 (NSIS Custom Build) xhtml-backend" />
<link rel="stylesheet" href="style.css" type='text/css' />
</head>
<body>
<p><a href='Chapter4.html'>Previous</a> | <a href='Contents.html'>Contents</a> | <a href='AppendixA.html'>Next</a></p>
<ul>
<li><a class="btitle" href="Chapter5.html#"><b>Chapter 5: </b>Compile Time Commands</a></li>
<ul>
<li><a href="Chapter5.html#5.1">Compiler Utility Commands</a></li>
<ul>
<li><a href="Chapter5.html#5.1.1">!include</a></li>
<li><a href="Chapter5.html#5.1.2">!addincludedir</a></li>
<li><a href="Chapter5.html#5.1.3">!addplugindir</a></li>
<li><a href="Chapter5.html#5.1.4">!appendfile</a></li>
<li><a href="Chapter5.html#5.1.5">!cd</a></li>
<li><a href="Chapter5.html#5.1.6">!delfile</a></li>
<li><a href="Chapter5.html#5.1.7">!echo</a></li>
<li><a href="Chapter5.html#5.1.8">!error</a></li>
<li><a href="Chapter5.html#5.1.9">!execute</a></li>
<li><a href="Chapter5.html#5.1.10">!packhdr</a></li>
<li><a href="Chapter5.html#5.1.11">!system</a></li>
<li><a href="Chapter5.html#5.1.12">!tempfile</a></li>
<li><a href="Chapter5.html#5.1.13">!warning</a></li>
<li><a href="Chapter5.html#5.1.14">!verbose</a></li>
</ul>
<li><a href="Chapter5.html#5.2">Predefines</a></li>
<ul>
<li><a href="Chapter5.html#5.2.1">${__FILE__}</a></li>
<li><a href="Chapter5.html#5.2.2">${__LINE__}</a></li>
<li><a href="Chapter5.html#5.2.3">${__DATE__}</a></li>
<li><a href="Chapter5.html#5.2.4">${__TIME__}</a></li>
<li><a href="Chapter5.html#5.2.5">${__TIMESTAMP__}</a></li>
<li><a href="Chapter5.html#5.2.6">${NSIS_VERSION}</a></li>
<li><a href="Chapter5.html#5.2.7">Scope Predefines</a></li>
</ul>
<li><a href="Chapter5.html#5.3">Read environment variables</a></li>
<ul>
<li><a href="Chapter5.html#5.3.1">$%envVarName%</a></li>
</ul>
<li><a href="Chapter5.html#5.4">Conditional Compilation</a></li>
<ul>
<li><a href="Chapter5.html#5.4.1">!define</a></li>
<li><a href="Chapter5.html#5.4.2">!undef</a></li>
<li><a href="Chapter5.html#5.4.3">!ifdef</a></li>
<li><a href="Chapter5.html#5.4.4">!ifndef</a></li>
<li><a href="Chapter5.html#5.4.5">!if</a></li>
<li><a href="Chapter5.html#5.4.6">!ifmacrodef</a></li>
<li><a href="Chapter5.html#5.4.7">!ifmacrondef</a></li>
<li><a href="Chapter5.html#5.4.8">!else</a></li>
<li><a href="Chapter5.html#5.4.9">!endif</a></li>
<li><a href="Chapter5.html#5.4.10">!insertmacro</a></li>
<li><a href="Chapter5.html#5.4.11">!macro</a></li>
<li><a href="Chapter5.html#5.4.12">!macroend</a></li>
<li><a href="Chapter5.html#5.4.13">!searchparse</a></li>
<li><a href="Chapter5.html#5.4.14">!searchreplace</a></li>
</ul>
</ul>
</ul>
<a name="5"></a><h1>Chapter 5: Compile Time Commands</h1>
<a name="5.1"></a><h2>5.1 Compiler Utility Commands</h2>
<p>These commands are similar to the C preprocessor in terms of purpose and functionality. They allow file inclusion, conditional compilation, executable header packing, and processes execution during the build process. Note: none of these commands allow use of variables.</p>
<a name="5.1.1"></a><h3>5.1.1 !include</h3>
<pre>[/NONFATAL] file
</pre>
<p>This command will include 'file' as if it was part of the original script. Note that if a file is included in another directory, the current directory is still where the script was compiled from (not where the included file resides). If the compiler can't find the file it will look for it in every include directory. See <a href="Chapter5.html#5.1.2">!addincludedir</a> for more information. If the /nonfatal switch is used and no files are found, a warning will be issued instead of an error.</p>
<pre>!include WinMessages.nsh
!include Library.nsh
!include C:\MyConfig.nsi
!include ..\MyConfig.nsh
!include /NONFATAL file_that_may_exist_or_not.nsh
</pre>
<a name="5.1.2"></a><h3>5.1.2 !addincludedir</h3>
<pre>directory
</pre>
<p>Adds another include directory to the include directories list. This list is searched when !include is used. This list's initial value is ${NSISDIR}\Include alone.</p>
<pre>!addincludedir ..\include
!include something.nsh
</pre>
<a name="5.1.3"></a><h3>5.1.3 !addplugindir</h3>
<pre>directory
</pre>
<p>Causes the NSIS compiler to scan the given directory for plug-in DLLs.</p>
<pre>!addplugindir myplugin
MyPlugin::SomeFunction
</pre>
<a name="5.1.4"></a><h3>5.1.4 !appendfile</h3>
<pre>file text
</pre>
<p>Appends <em>text</em> to <em>file</em>.</p>
<pre>!tempfile FILE
!appendfile "${FILE}" "XPStyle on$\n"
!appendfile "${FILE}" "Name 'test'$\n"
!include "${FILE}"
!delfile "${FILE}"
!undef FILE
</pre>
<a name="5.1.5"></a><h3>5.1.5 !cd</h3>
<pre>new_path
</pre>
<p>This command will change the compiler to the new directory, new_path. new_path can be relative or absolute.</p>
<pre>!cd ..\more-scripts\new
</pre>
<a name="5.1.6"></a><h3>5.1.6 !delfile</h3>
<pre>file
</pre>
<p>This command deletes a file.</p>
<pre>!tempfile FILE
!delfile "${FILE}"
!undef FILE
</pre>
<a name="5.1.7"></a><h3>5.1.7 !echo</h3>
<pre>message
</pre>
<p>This command will echo a message to the user compiling the script.</p>
<pre>!echo "hello world"
</pre>
<a name="5.1.8"></a><h3>5.1.8 !error</h3>
<pre>[message]
</pre>
<p>This command will issue an error to the script compiler and will stop execution of the script. You can also add a message to this error.</p>
<pre>!ifdef VERSION & NOVERSION
!error "both VERSION and NOVERSION are defined"
!endif
</pre>
<a name="5.1.9"></a><h3>5.1.9 !execute</h3>
<pre>command
</pre>
<p>This command will execute 'command' using a call to CreateProcess(). Unlike <a href="Chapter5.html#5.1.11">!system</a>, it does not use the command line processor, so input/output redirection and commands like 'cd', 'dir' and 'type' can not be used. !execute also ignores the return value of the executed command. Currently, the only known advantage of !execute over <a href="Chapter5.html#5.1.11">!system</a> is that it does not give trouble when the current working directory is specified using UNC.</p>
<p>On POSIX platforms, !execute will use system() just like <a href="Chapter5.html#5.1.11">!system</a>.</p>
<pre>!execute '"%WINDIR%\notepad.exe" "${NSISDIR}\license.txt"'
</pre>
<a name="5.1.10"></a><h3>5.1.10 !packhdr</h3>
<pre>tempfile command
</pre>
<p>This option makes the compiler use an external EXE packer (such as <a href="http://www.un4seen.com/petite/">Petite</a> or <a href="http://upx.sourceforge.net/">UPX</a>) to compress the executable header. Specify a temporary file name (such as "temp.dat") and a command line (such as "C:\program files\upx\upx -9 temp.dat") to compress the header.</p>
<pre>!packhdr "$%TEMP%\exehead.tmp" '"C:\Program Files\UPX\upx.exe" "$%TEMP%\exehead.tmp"'
</pre>
<a name="5.1.11"></a><h3>5.1.11 !system</h3>
<pre>command [compare comparevalue]
</pre>
<p>This command will execute 'command' using a call to system(), and if the return value compared (using 'compare') to 'comparevalue' is false, execution will halt. 'compare' can be '<' or '>' or '<>' or '='.</p>
<pre>!system '"%WINDIR%\notepad.exe" "${NSISDIR}\license.txt"'
!system 'echo !define something > newinclude.nsh'
!include newinclude.nsh
!ifdef something
!echo "something is defined"
!endif
</pre>
<a name="5.1.12"></a><h3>5.1.12 !tempfile</h3>
<pre>symbol
</pre>
<p>This command creates a temporary file. It puts its path into a define, named <em>symbol</em>.</p>
<pre>!tempfile PACKHDRTEMP
!packhdr "${PACKHDRTEMP}" '"C:\Program Files\UPX\upx.exe" "${PACKHDRTEMP}"'
</pre>
<pre>!tempfile FILE
!define /date DATE "%H:%M:%S %d %b, %Y"
!system 'echo built on ${DATE} > "${FILE}"'
File /oname=build.txt "${FILE}"
!delfile "${FILE}"
!undef FILE
!undef DATE
</pre>
<a name="5.1.13"></a><h3>5.1.13 !warning</h3>
<pre>[message]
</pre>
<p>This command will issue a warning to the script compiler. You can also add a message to this warning.</p>
<pre>!ifdef USE_DANGEROUS_STUFF
!warning "using dangerous stuff"
!endif
</pre>
<a name="5.1.14"></a><h3>5.1.14 !verbose</h3>
<pre>level | push | pop
</pre>
<p>This command will set the level of verbosity. 4=all, 3=no script, 2=no info, 1=no warnings, 0=none.</p>
<p>Passing push will cause !verbose to push the current verbosity level on a special stack. Passing pop will cause !verbose to pop the current verbosity level from the same stack and use it.</p>
<pre>!verbose push
!verbose 1
!include WinMessages.nsh
!verbose pop
</pre>
<a name="5.2"></a><h2>5.2 Predefines</h2>
<p>You can use these standard predefines to automatically add the build time to the title of development versions, add the date to the version number, etc.</p>
<a name="5.2.1"></a><h3>5.2.1 ${__FILE__}</h3>
<p>Current script name.</p>
<a name="5.2.2"></a><h3>5.2.2 ${__LINE__}</h3>
<p>Current line number.</p>
<a name="5.2.3"></a><h3>5.2.3 ${__DATE__}</h3>
<p>Date when the script started compiling according to the current locale.</p>
<a name="5.2.4"></a><h3>5.2.4 ${__TIME__}</h3>
<p>Time when the script started compiling according to the current locale.</p>
<a name="5.2.5"></a><h3>5.2.5 ${__TIMESTAMP__}</h3>
<p>Date & time of the last modification to the script file according to the current locale.</p>
<a name="5.2.6"></a><h3>5.2.6 ${NSIS_VERSION}</h3>
<p>NSIS version used to build the script.</p>
<a name="5.2.7"></a><h3>5.2.7 Scope Predefines</h3>
<p>Standard predefines that contain information of the current code scope.</p>
<a name="5.2.7.1"></a><h4>5.2.7.1 ${__GLOBAL__}</h4>
<p>Defined in the global scope.</p>
<pre>Section test
!ifdef ${__GLOBAL__}
!error "this shouldn't be here!"
!endif
SectionEnd
Function test
!ifdef ${__GLOBAL__}
!error "this shouldn't be here!"
!endif
FunctionEnd
PageEx instfiles
!ifdef ${__GLOBAL__}
!error "this shouldn't be here!"
!endif
PageExEnd
</pre>
<a name="5.2.7.2"></a><h4>5.2.7.2 ${__SECTION__}</h4>
<p>Defined as the section name, without any prefixes, in <a href="Chapter4.html#4.6.1.2">section</a> scope.</p>
<pre>!ifdef __SECTION__
!error "this shouldn't be here!"
!endif
Section test
!ifndef __SECTION__
!error "missing predefine!"
!endif
!if ${__SECTION__} != test
!error "wrong predefine value!"
!endif
SectionEnd
Section !test
!if ${__SECTION__} != test
!error "wrong predefine value!"
!endif
SectionEnd
Section un.test
!if ${__SECTION__} != test
!error "wrong predefine value!"
!endif
SectionEnd
</pre>
<a name="5.2.7.3"></a><h4>5.2.7.3 ${__FUNCTION__}</h4>
<p>Defined as the function name, without any prefixes, in <a href="Chapter4.html#4.7.1.1">function</a> scope.</p>
<pre>!ifdef __FUNCTION__
!error "this shouldn't be here!"
!endif
Function test
!ifndef __FUNCTION__
!error "missing predefine!"
!endif
!if ${__FUNCTION__} != test
!error "wrong predefine value!"
!endif
FunctionEnd
Function un.test
!if ${__FUNCTION__} != test
!error "wrong predefine value!"
!endif
FunctionEnd
</pre>
<a name="5.2.7.4"></a><h4>5.2.7.4 ${__PAGEEX__}</h4>
<p>Defined as the page type in <a href="Chapter4.html#4.5.6">PageEx</a> scope.</p>
<pre>!ifdef __PAGEEX__
!error "this shouldn't be here!"
!endif
PageEx instfiles
!ifndef __PAGEEX__
!error "missing predefine!"
!endif
!if ${__PAGEEX__} != instfiles
!error "wrong page type"
!endif
PageExEnd
</pre>
<a name="5.2.7.5"></a><h4>5.2.7.5 ${__UNINSTALL__}</h4>
<p>Defined in <a href="Chapter4.html#4.6.1.2">section</a>, <a href="Chapter4.html#4.7.1.1">function</a> or <a href="Chapter4.html#4.5.6">PageEx</a> scopes of the uninstaller.</p>
<pre>!ifdef __UNINSTALL__
!error "this shouldn't be here!"
!endif
Function test
!ifdef __UNINSTALL__
!error "this shouldn't be here!"
!endif
FunctionEnd
Function un.test
!ifndef __UNINSTALL__
!error "missing predefine!"
!endif
FunctionEnd
</pre>
<a name="5.3"></a><h2>5.3 Read environment variables</h2>
<a name="5.3.1"></a><h3>5.3.1 $%envVarName%</h3>
<p>$%envVarName% will be replaced on compile time by the environment variable envVarName.</p>
<a name="5.4"></a><h2>5.4 Conditional Compilation</h2>
<p>The compiler maintains a list of defined symbols, which can be defined using !define or the /D command line switch. These defined symbols can be used for conditional compilation (using !ifdef) or for symbol replacement (a simple form of macros). To replace a symbol with its value, use ${SYMBOL} (if SYMBOL is not defined, no translation will occur). The translation is first-come-first-served, meaning if you do:</p>
<pre>!define symbol_one ${symbol_two}
</pre>
<p>If symbol_two is defined when that line occurs, it will be replaced. Otherwise, any replacing will occur when ${symbol_one} is referenced.</p>
<p>Define/conditional compilation related commands:</p>
<a name="5.4.1"></a><h3>5.4.1 !define</h3>
<pre>([/date|/utcdate] gflag [value]) | (/math gflag val1 OP val2) | (/file gflag filename.txt)
</pre>
<p>This command will add <em>gflag</em> to the global define list. This will have a similar effect as using the /D switch on the command line (only the define only becomes effective after the !define command).</p>
<p>If <em>/date</em> or <em>/utcdate</em> are used, <em>value</em> will be passed into strftime and the result will be used as the value of <em>gflag</em>. strftime converts special symbols into certain parts of the current time or date. For example, %H will be converted into the current hour in 24-hour format. For a complete list of available symbols, search for strftime on <a href="http://msdn.microsoft.com/">MSDN</a>. On POSIX, you can get the list by using <code>man strftime</code>.</p>
<p>If <em>/math</em> is used, the result of 'val1 OP val2', where OP may be +,-,*,&,|,^,/ or % , will be used as the value of <em>gflag</em>. Note that val1 AND val2 MUST be integer values!</p>
<p>If <em>/file</em> is used, the entire text file specified (including whitespace and newlines) will be read and stuffed into <em>gflag</em>.</p>
<pre>!define USE_SOMETHING
!define VERSION 1.2
!define /date NOW "%H:%M:%S %d %b, %Y"
!define /math RESULT 3 + 10
!define /math REST 15 % ${RESULT}
!define /file BUNCHASTUFF somesourcefile.cpp
</pre>
<a name="5.4.2"></a><h3>5.4.2 !undef</h3>
<pre>gflag
</pre>
<p>Removes an item from the global define list. Note that ${SYMBOL} where SYMBOL is undefined will be translated to "${SYMBOL}".</p>
<pre>!define SOMETHING
!undef SOMETHING
</pre>
<a name="5.4.3"></a><h3>5.4.3 !ifdef</h3>
<pre>gflag [bcheck gflag [...]]]
</pre>
<p>This command, when paired with an !endif command, will tell the compiler whether or not to compile the lines in between the two lines. If gflag is globally defined (using !define or the /D switch), then the contained lines will be compiled. Otherwise, they will be skipped. 'bcheck' can be specified as & (boolean and) or | (boolean or) along with more gflags -- precedence is simple, left to right.</p>
<pre>!define SOMETHING
!ifdef SOMETHING
!echo "SOMETHING is defined"
!endif
!undef SOMETHING
!ifdef SOMETHING
!echo "SOMETHING is defined" # will never be printed
!endif
</pre>
<a name="5.4.4"></a><h3>5.4.4 !ifndef</h3>
<pre>gflag [bcheck gflag [...]]]
</pre>
<p>The opposite of !ifdef. The lines will be compiled when the gflag has not been defined.</p>
<a name="5.4.5"></a><h3>5.4.5 !if</h3>
<pre>[!] value [op value2]
</pre>
<p>This command, when paired with an !endif command, will tell the compiler whether or not to compile the lines in between the two lines. If value is non-zero, or the comparison of value and value2 depending on the operator results in true, the contained lines will be compiled. Otherwise, they will be skipped. op can be either == or != (string comparison), <=, < > or >= (float comparison), && or || (boolean comparison). If [!] is set, return value will be switched from true to false and vice versa.</p>
<pre>!if 1 < 2
!echo "1 is smaller than 2!!"
!else if ! 3.1 > 1.99
!error "this line should never appear"
!else
!error "neither should this"
!endif
</pre>
<a name="5.4.6"></a><h3>5.4.6 !ifmacrodef</h3>
<pre>gflag [bcheck gflag [...]]]
</pre>
<p>This command, when paired with an !endif command, will tell the compiler whether or not to compile the lines in between the two lines. If the macro gflag exists, then the contained lines will be compiled. Otherwise, they will be skipped. 'bcheck' can be specified as & (boolean and) or | (boolean or) along with more gflags -- precedence is simple, left to right.</p>
<pre>!macro SomeMacro
!macroend
!ifmacrodef SomeMacro
!echo "SomeMacro is defined"
!endif
</pre>
<a name="5.4.7"></a><h3>5.4.7 !ifmacrondef</h3>
<pre>gflag [bcheck gflag [...]]]
</pre>
<p>The opposite of !ifmacrodef. The lines will be compiled when the macro gflag does not exist.</p>
<a name="5.4.8"></a><h3>5.4.8 !else</h3>
<pre>[if|ifdef|ifndef|ifmacrodef|ifmacrondef [...]]
</pre>
<p>This command allows to easily insert different code when different defines or macros are set. You can create blocks like !ifdef/!else/!endif, !ifdef/!else ifdef/!else/!endif etc.</p>
<pre>!ifdef VERSION
OutFile installer-${VERSION}.exe
!else
OutFile installer.exe
!endif
</pre>
<a name="5.4.9"></a><h3>5.4.9 !endif</h3>
<p>This command closes a block started with !if, !ifdef, !ifndef, !ifmacrodef or !ifmacrondef.</p>
<a name="5.4.10"></a><h3>5.4.10 !insertmacro</h3>
<pre>macro_name [parameter] [...]
</pre>
<p>Inserts the contents of a macro that was created with !macro. If the macro was created with parameters, then you must pass as many parameters to the macro as it requires.</p>
<pre>!macro Print text
DetailPrint "${text}"
!macroend
!insertmacro Print "some text"
!insertmacro Print "some more text"
</pre>
<a name="5.4.11"></a><h3>5.4.11 !macro</h3>
<pre>macro_name [parameter][...]
</pre>
<p>Creates a macro named 'macro_name'. All lines between the !macro and the !macroend will be saved. To insert the macro later on, use !insertmacro. !macro definitions can have one or more parameters defined. The parameters may be accessed the same way a !define would (e.g. ${PARMNAME}) from inside the macro.</p>
<pre>!macro SomeMacro parm1 parm2 parm3
DetailPrint "${parm1}"
MessageBox MB_OK "${parm2}"
File "${parm3}"
!macroend
</pre>
<a name="5.4.12"></a><h3>5.4.12 !macroend</h3>
<p>Ends a macro that was started with !macro.</p>
<a name="5.4.13"></a><h3>5.4.13 !searchparse</h3>
<pre>[/ignorecase] [/noerrors] [/file] source_string_or_file substring_start OUTPUTSYMBOL1 [substring [OUTPUTSYMBOL2 [substring ...]]]
</pre>
<p>Parses <em>source_string_or_file</em> (which is treated as a string, or as a filename if <em>/file</em> is set), looking for <em>substring_start</em>. If <em>substring_start</em> is found, then <em>OUTPUTSYMBOL1</em> is defined to the rest of the string (minus any other <em>substring</em> that may be found). Any number of <em>OUTPUTSYMBOLx</em> may be specified, and the final <em>substring</em> is optional.</p>
<p>If <em>/noerrors</em> is specified, matching less than the full number of strings is allowed (all <em>OUTPUTSYMBOLx</em> after the not-found substring will be ignored).</p>
<p>If <em>/file</em> is specified, the file is treated as a series of lines. The file is searched until all substrings are matched. If <em>/noerrors</em> is specified and not all strings are matched, the first line with the most symbols matched is used.</p>
<pre># search filename.cpp for a line '#define APP_VERSION "2.5"' and set ${VER_MAJOR} to 2, ${VER_MINOR} to 5.
!searchparse /file filename.cpp `#define APP_VERSION "` VER_MAJOR `.` VER_MINOR `"`
</pre>
<a name="5.4.14"></a><h3>5.4.14 !searchreplace</h3>
<pre>[/ignorecase] symbol_out source_string searchfor replacewith
</pre>
<p>Searches <em>source_string</em>, looking for <em>searchfor</em> and replacing all instances of it with <em>replacewith</em>. Unlike !define, !searchreplace allows you to redefine <em>symbol_out</em> without warning or error.</p>
<pre># defines ${blah} to "i like ponies"
!searchreplace blah "i love ponies" "love" "like"
</pre>
<p><a href='Chapter4.html'>Previous</a> | <a href='Contents.html'>Contents</a> | <a href='AppendixA.html'>Next</a></p>
<hr />
<address>
</address>
</body>
</html>
|