| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216 |
- <?xml version="1.0"?>
- <!DOCTYPE yasyx SYSTEM "ispp.dtd" [
- <!ENTITY sp " ">
- <!ENTITY dsp "  ">
- <!ENTITY define '<tt><link href="define">define</link></tt>'>
- <!ENTITY undef '<tt><link href="undef">undef</link></tt>'>
- <!ENTITY dim '<tt><link href="dim">dim</link></tt>'>
- <!ENTITY redim '<tt><link href="dim">redim</link></tt>'>
- <!ENTITY emit '<tt><link href="emit">emit</link></tt>'>
- <!ENTITY error '<tt><link href="error">error</link></tt>'>
- <!ENTITY include '<tt><link href="include">include</link></tt>'>
- <!ENTITY insert '<tt><link href="insert">insert</link></tt>'>
- <!ENTITY pragma '<tt><link href="pragma">pragma</link></tt>'>
- <!ENTITY file '<tt><link href="file">file</link></tt>'>
- <!ENTITY ifdef '<tt><link href="ifdef">ifdef</link></tt>'>
- <!ENTITY ifndef '<tt><link href="ifdef">ifndef</link></tt>'>
- <!ENTITY ifexist '<tt><link href="ifdef">ifexist</link></tt>'>
- <!ENTITY ifnexist '<tt><link href="ifdef">ifnexist</link></tt>'>
- <!ENTITY if '<tt><link href="if">if</link></tt>'>
- <!ENTITY elif '<tt><link href="if">elif</link></tt>'>
- <!ENTITY else '<tt><link href="if">else</link></tt>'>
- <!ENTITY endif '<tt><link href="if">endif</link></tt>'>
- <!ENTITY sub '<tt><link href="sub">sub</link></tt>'>
- <!ENTITY endsub '<tt><link href="sub">endsub</link></tt>'>
- <!ENTITY for '<tt><link href="for">for</link></tt>'>
- <!ENTITY expr '<tt>expr</tt>'> <!-- not a directive -->
- <!ENTITY curtrans '<link href="current-translation">current preprocessor output</link>'>
- <!ENTITY translation '<link href="translation">preprocessor output</link>'>
- <!ENTITY builtins '<link href="builtinsiss">ISPPBuiltins.iss</link>'>
- <!ENTITY dash "–">
- ]>
- <yasyx>
- <topic id="isppoverview">
- <title>Introduction</title>
- <description header="no">
- <p>The main purpose of Inno Setup Preprocessor (ISPP) is to automate compile-time tasks and avoid repetition in your scripts. For example, you can declare a compile-time preprocessor variable ‐ containing your application name, for instance ‐ and then use its value in several places of your script. If for some reason you need to change the name of your application, you'll have to change it only once in your script. Without the preprocessor, you would need to change all occurrences of your application name throughout the script.</p>
- <p>Another example of using the preprocessor would be gathering version information from your application at compile-time by reading the version info of an EXE file, and using it in your <link href="setup_appvername">AppVerName</link> [Setup] section directive or anywhere else. Without the preprocessor, you would have to modify your script each time the version of your application changes.</p>
- <p>The preprocessor can even scan your source folder and generate script lines for the found files. Without the preprocessor, you would have to manually maintain the list of files.</p>
- <p>Conditional in- and exclusion of portions of script is also possible by using the preprocessor: you can create one single script for different versions/levels of your applications (for example, trial versus fully functional). Without the preprocessor, you would need multiple scripts.</p>
- <p>Finally, the preprocessor makes it possible to split long lines using a line spanning symbol.</p>
- <p>Note: the preprocessor works exclusively at compile-time, and has no run-time functionality.</p>
- </description>
- <subtopicstitle>All topics</subtopicstitle>
- <topic id="directives">
- <title>Directives Reference</title>
- <description header="no">
- <p>There are two kinds of directives in ISPP: simple and inline.</p>
- <p>Simple directives occupy a whole line and begin with the <tt>#</tt> symbol. For example the following defines a variable called <tt>MyAppName</tt>:</p>
- <pre>
- <line>#define MyAppName "My Program"</line>
- </pre>
- <p>Inline directives appear inside other lines and begin with <tt>{#</tt> and end with <tt>}</tt>. For example the following sets Inno Setup's <tt>AppName</tt> directive to the value of the previously defined variable:</p>
- <pre>
- <line>[Setup]</line>
- <line>AppName={#MyAppName}</line>
- </pre>
- <p>As seen in the above example it is not necessary to specify the name of the &emit; directive when it is used inline, so <tt>{#MyAppName}</tt> is short for <tt>{#emit MyAppName}</tt>.</p>
- </description>
- <section title="Directive syntax documenting conventions">
- <p>Directive usage syntax uses the following conventions.</p>
- <table>
- <tr><td><code>()</code></td><td>Group of tokens.</td></tr>
- <tr><td><code>[]</code></td><td>Optional token or group of tokens.</td></tr>
- <tr><td><code>|</code></td><td>Mutually exclusive tokens.</td></tr>
- <tr><td><code>...</code></td><td>Previous token or group of tokens can be repeated.</td></tr>
- <tr><td><code><b>token</b></code></td><td>Reserved word or symbol(s). Must be typed exactly as shown.</td></tr>
- <tr><td><code><token></code></td><td>Non-terminal. Its syntax is either shown before, or explained.</td></tr>
- </table>
- </section>
- <subtopicstitle>Available directives</subtopicstitle>
- <topic id="define">
- <title>#define</title>
- <keywords>
- <kwd>#:</kwd>
- <kwd>define</kwd>
- </keywords>
- <syntax>
- <define id="define-directive">
- <variant><nt name="variable-definition"/></variant>
- <variant><nt name="macro-definition"/></variant>
- <variant><nt name="default-visibility-set"/></variant>
- </define>
- <define id="variable-definition">
- <group><nt name="define-dir-name"/></group><opt><nt name="locality"/></opt><nt>ident</nt><opt><nt name="index-spec"/></opt><opt><opt><txt>=</txt></opt><nt>expr</nt></opt>
- </define>
- <define id="macro-definition">
- <group><nt name="define-dir-name"/></group><opt><nt name="locality"/></opt><nt>ident</nt><txt>(</txt><opt><nt name="formal-macro-args"/></opt><txt>)</txt><nt>expr</nt>
- </define>
- <define id="default-visibility-set">
- <group><nt name="define-dir-name"/></group><nt name="locality"/>
- </define>
- <define id="define-dir-name" inline="yes">
- <cases>
- <case><txt>define</txt></case>
- <case><txt>:</txt></case>
- </cases>
- </define>
- <define id="formal-macro-args">
- <nt name="formal-macro-arg"/><opt repeated="yes"><txt>,</txt><nt name="formal-macro-arg"/></opt>
- </define>
- <define id="formal-macro-arg">
- <cases>
- <case><nt name="by-val-arg"/></case>
- <case><nt name="by-ref-arg"/></case>
- </cases>
- </define>
- <define id="by-val-arg">
- <opt><nt name="type-id"/></opt><nt>ident</nt><opt><txt>=</txt><nt>expr</nt></opt>
- </define>
- <define id="by-ref-arg">
- <opt><nt name="type-id"/></opt><txt>*</txt><nt>ident</nt>
- </define>
- <define id="type-id">
- <cases>
- <case><txt>any</txt></case>
- <case><txt>int</txt></case>
- <case><txt>str</txt></case>
- <case><txt>func</txt></case>
- </cases>
- </define>
- <define id="locality" inline="yes">
- <cases>
- <case><txt>private</txt></case>
- <case><txt>protected</txt></case>
- <case><txt>public</txt></case>
- </cases>
- </define>
- </syntax>
- <description>
- <p>The first syntax ("variable-definition") defines a variable named <tt>ident</tt>, or assigns a value to an element of an array named <tt>ident</tt> (use &dim; instead of <tt>define</tt> to define the array variable itself). If none of the <tt>public</tt>, <tt>protected</tt>, or <tt>private</tt> keywords are specified, default <link href="visibility">visibility</link> is assumed.</p>
- <p>The second syntax ("macro-definition") defines <link href="macros">a user defined function</link> named <tt>ident</tt>. When defining a user defined function there must be no whitespace between the name and opening parenthesis, otherwise it will be treated as variable declaration.</p>
- <p>The third syntax ("default-visibility-set") sets the default <link href="visibility">visibility</link> of further variable and user defined function definitions in this file. If no visibility declaration occurs in a file, public visibility is assumed by default.</p>
- </description>
- <section title="Examples">
- <pre>
- <line>#define MyAppName "My Program"</line>
- <line>#define MyAppExe MyAppName + ".exe"</line>
- <line>#define MyAppVer <link href="GetVersionNumbersString">GetVersionNumbersString</link>(MyAppExe)</line>
- <line>#define MyArray[0] 15</line>
- <line>#define Multiply(int A, int B = 10) A * B</line>
- </pre>
- </section>
- <section title="See also">
- <p>&dim;, &undef;, <link href="visibility"/>.</p>
- <p><link href="macros"/>.</p>
- </section>
- </topic>
- <topic id="dim">
- <title>#dim, #redim</title>
- <keywords>
- <kwd>dim</kwd>
- <kwd>#redim</kwd>
- <kwd>redim</kwd>
- </keywords>
- <syntax>
- <define id="dim-directive">
- <txt>dim</txt><opt><nt name="locality"/></opt><nt>ident</nt><nt name="index-spec"/><opt><nt name="initializers-spec"/></opt>
- </define>
- <define id="redim-directive">
- <txt>redim</txt><opt><nt name="locality"/></opt><nt>ident</nt><nt name="index-spec"/>
- </define>
- <define id="index-spec" inline="yes">
- <txt>[</txt><nt>expr</nt><txt>]</txt>
- </define>
- <define id="initializers-spec" inline="yes">
- <txt>{</txt><nt>expr</nt><opt repeated="yes"><txt>,</txt><nt>expr</nt></opt><txt>}</txt>
- </define>
- </syntax>
- <description>
- <p>Use &dim; to define an array variable, set its dimension and optionally intialize it. All unitialized elements of the array are initialized to null (void). To assign an element value after declaring the array, use &define;. Instead of assigning element values with &define;, it is also possible to set an element value by using it as the left operand of an assignment.</p>
- <p>Use &redim; to increase or decrease the dimension of an existing array variable. All new elements of the array are initialized to null (void) and existing elements are left unchanged. Identical to &dim; if <tt>ident</tt> isn't an existing array variable.</p>
- </description>
- <section title="Examples">
- <pre>
- <line>#dim MyArray[10]</line>
- <line>#define MyArray[0] 15</line>
- <line>#redim MyArray[20]</line>
- <line>#define MyArray[10] 30</line>
- <line>#redim MyArray[10]</line>
- <line>#dim MyArray2[3] {1, 2, 3}</line>
- </pre>
- </section>
- <section title="See also">
- <p>&define;, &undef;, <link href="DimOf"/>, <link href="visibility"/>.</p>
- </section>
- </topic>
- <topic id="undef">
- <title>#undef</title>
- <keywords>
- <kwd>#x</kwd>
- <kwd>undef</kwd>
- </keywords>
- <syntax>
- <define id="undef-directive">
- <group><nt name="undef-dir-name"/></group><opt><nt name="locality"/></opt><nt>ident</nt>
- </define>
- <define id="undef-dir-name" inline="yes">
- <cases>
- <case><txt>undef</txt></case>
- <case><txt>x</txt></case>
- </cases>
- </define>
- </syntax>
- <description>
- <p>Undefines (removes) a variable or user defined function. If no <link href="visibility">visibility</link> (<tt>public</tt>, <tt>protected</tt>, or <tt>private</tt>) is specified, ISPP first tries to remove a private variable of the given name, then protected, then public.</p>
- </description>
- <section title="Examples">
- <pre>
- <line>#undef MyVar</line>
- <line>#undef MyFunction</line>
- <line>#undef public MyVar</line>
- </pre>
- </section>
- <section title="See also">
- <p>&define;, &dim;, <link href="visibility"/>.</p>
- </section>
- </topic>
- <topic id="include">
- <title>#include</title>
- <keywords>
- <kwd>#+</kwd>
- <kwd>include</kwd>
- </keywords>
- <syntax>
- <define id="include-directive">
- <variant><group><nt name="inc-dir-name"/></group><txt><</txt><nt>filename</nt><txt>></txt></variant>
- <variant><group><nt name="inc-dir-name"/></group><nt>expr</nt></variant>
- </define>
- <define id="inc-dir-name" inline="yes">
- <cases>
- <case><txt>include</txt></case>
- <case><txt>+</txt></case>
- </cases>
- </define>
- </syntax>
- <description>
- <p>Includes the &translation; of the specified file. If an Unicode file is used, it must be UTF-8 (with or without a BOM) encoded</p>
- <p>If the filename is enclosed in quotes, ISPP first searches for the file in the directory where current file resides, then in the directory where the file that included current file resides, and so on. If the file is not found, it is searched on current include path, set via &pragma;, then on the path specified by INCLUDE environment variable.</p>
- <p>If filename is an expression or specified in angle brackets, it is searched on current include path only.</p>
- <p>The filename may be prefixed by "compiler:", in which case it looks for the file in the Compiler directory.</p>
- <p>This directive cannot be used inline.</p>
- </description>
- <section title="Examples">
- <pre>
- <line>#include <file.iss></line>
- <line>#include "c:\dir\file.iss"</line>
- <line>#include <link href="addbackslash">AddBackslash</link>(<link href="predefinedvars">CompilerPath</link>) + "common.iss"</line>
- </pre>
- </section>
- <section title="See also">
- <p>&file;, ⊂.</p>
- </section>
- </topic>
- <topic id="file">
- <title>#file</title>
- <keywords><kwd>file</kwd></keywords>
- <syntax>
- <define id="file-directive">
- <txt>file</txt><nt>expr</nt>
- </define>
- </syntax>
- <description>
- <p>Replaces the directive with the name of a temporary file containing the &translation; of the specified file. Upon end of compilation, the temporary file is automatically deleted. If an Unicode file is used, it must be UTF-8 (with or without a BOM) encoded.</p>
- <p>Including a file using this directive creates a new independent instance of the preprocessor, passing it options currently in effect and all declared identifiers. If the included file modifies options in some way, they are not propagated back.</p>
- <p>When using this directive in Inno Setup's Source parameter of the [Files] section, specify a DestName parameter too, else the file with not be installed with the original name.</p>
- <p>This directive can only be used <link href="directives">inline</link>.</p>
- </description>
- <section title="Examples">
- <pre>
- <line>[Setup]</line>
- <line>LicenseFile={#file "mylic.txt"}</line>
- </pre>
- </section>
- <section title="See also">
- <p>&include;.</p>
- </section>
- </topic>
- <topic id="emit">
- <title>#emit</title>
- <keywords>
- <kwd>#=</kwd>
- <kwd>emit</kwd>
- </keywords>
- <syntax>
- <define id="emit-directive">
- <group><nt name="emit-dir-name"/></group><nt>expr</nt>
- </define>
- <define id="emit-dir-name" inline="yes">
- <cases>
- <case><txt>emit</txt></case>
- <case><txt>=</txt></case>
- </cases>
- </define>
- </syntax>
- <description>
- <p>Replaces the directive with the value of &expr;.</p>
- <p>When used <link href="directives">inline</link>, the name of this directive can be omitted unless &expr; begins with the name of another directive.</p>
- <p>This means you can, for example, use <tt>{#MyDestDir}</tt> instead of <tt>{#emit MyDestDir}</tt> or <tt>{#=MyDestDir}</tt></p>
- </description>
- <section title="Examples">
- <pre>
- <line>[Setup]</line>
- <line>AppVersion={#<link href="getversionnumbersstring">GetVersionNumbersString</link>(<link href="addbackslash">AddBackslash</link>(SourcePath) + "MyProg.exe")}</line>
- <line></line>
- <line>[Files]</line>
- <line>#emit 'Source: "file1.ext"; DestDir: ' + MyDestDir</line>
- <line>Source: "file2.ext"; DestDir: {#MyDestDir}</line>
- <line>#emit GenerateVisualCppFilesEntries ; user defined function</line>
- <line></line>
- <line>[Code]</line>
- <line>const</line>
- <line>&dsp;AppName = '{#<link href="setupsetting">SetupSetting</link>("AppName")}';</line>
- </pre>
- </section>
- <section title="See also">
- <p><tt><link href="expr">expr</link></tt>.</p>
- </section>
- </topic>
- <topic id="expr">
- <title>#expr</title>
- <keywords>
- <kwd>#!</kwd>
- <kwd>expr</kwd>
- </keywords>
- <syntax>
- <define id="expr-directive">
- <group><nt name="expr-dir-name"/></group><nt>expr</nt>
- </define>
- <define id="expr-dir-name" inline="yes">
- <cases>
- <case><txt>expr</txt></case>
- <case><txt>!</txt></case>
- </cases>
- </define>
- </syntax>
- <description>
- <p>Evaluates an expression ignoring its result. This directive acts like &emit; with the exception that it doesn't emit anything to the &translation;.</p>
- <p>This directive is intended to be used with functions that produce side effects and do not return any significant value.</p>
- </description>
- <section title="Examples">
- <pre>
- <line>#expr <link href="savetofile">SaveToFile</link>(AddBackslash(SourcePath) + "Preprocessed.iss"), <link href="exec">Exec</link>(AddBackslash(CompilerPath) + "ISIDE.exe", """" + AddBackslash(SourcePath) + "Preprocessed.iss""")</line>
- </pre>
- </section>
- <section title="See also">
- <p>&emit;.</p>
- </section>
- </topic>
- <topic id="insert">
- <title>#insert</title>
- <keywords><kwd>insert</kwd></keywords>
- <syntax>
- <define id="insert-directive">
- <txt>insert</txt><nt>expr</nt>
- </define>
- </syntax>
- <description>
- <p>Changes the insertion point. By default, each processed line is appended to the end of the &translation;. Using &insert; the point at which the next processed line will be inserted into the &translation; can be set. &insert; takes an expression which must evaluate to a 0-based line index. If this index is 0, the next processed line is inserted at the beginning of the &translation;. If this index is 1, the next processed line is put in the second position of the &translation;, and so on.</p>
- <p>The insertion point is also always automatically incremented each time after a line has been added to the &translation;, so that each new line is inserted after the one previously inserted.</p>
- <p>It is not recommended to use script generating functions (such as <tt><link href="SetSetupSetting">SetSetupSetting</link></tt>) which may insert a line by themselves, thus shifting a part of the &translation; one line down, whereas insertion point is not updated. This may result in different insertion point than expected.</p>
- <p>The <tt><link href="find">Find</link></tt> function can be used to produce values for the &insert; directive.</p>
- </description>
- <section title="Examples">
- <pre>
- <line>#insert FindSectionEnd("Icons")</line>
- <line>#insert FindSection("Setup") + 1</line>
- <line>#insert <link href="find">Find</link>(0, "somefile.ext", FIND_CONTAINS)</line>
- </pre>
- </section>
- <section title="See also">
- <p><tt><link href="append">append</link></tt>.</p>
- </section>
- </topic>
- <topic id="append">
- <title>#append</title>
- <keywords><kwd>append</kwd></keywords>
- <syntax>
- <define id="append-directive">
- <txt>append</txt>
- </define>
- </syntax>
- <description>
- <p>Resets the insertion point (if previously changed using &insert;) to the end of the &translation;.</p>
- </description>
- <section title="See also">
- <p>&insert;.</p>
- </section>
- </topic>
- <topic id="if">
- <title>#if, #elif, #else, #endif</title>
- <keywords>
- <kwd>if</kwd>
- <kwd>#elif</kwd>
- <kwd>elif</kwd>
- <kwd>#else</kwd>
- <kwd>else</kwd>
- <kwd>#endif</kwd>
- <kwd>endif</kwd>
- </keywords>
- <syntax>
- <define id="if-directive">
- <txt>if</txt><nt>expr</nt>
- </define>
- <define id="elif-directive">
- <txt>elif</txt><nt>expr</nt>
- </define>
- <define id="else-directive">
- <txt>else</txt>
- </define>
- <define id="endif-directive">
- <txt>endif</txt>
- </define>
- </syntax>
- <description>
- <p>The &if;, &elif;, &else;, and &endif; conditional directives control in- and exclusion of portions of script.</p>
- <p>ISPP first evaluates the expressions following each &if; or &elif; directive until it finds one evaluating to non-zero. It then selects the portion of script following this directive up to its associated &elif;, &else;, or &endif;. Earlier portions which followed an &if; or &elif; which evaluated to zero, or which follows any next &elif; are not selected and thus not seen by the Inno Setup compiler.</p>
- <p>If no expression evaluated to non-zero, the preprocessor selects the script portion after the &else; directive if present, otherwise nothing is selected.</p>
- <p>Finally, after selecting any script portion, ISPP preprocesses it too, so if it contains other preprocessor directives, ISPP carries out those directives as well.</p>
- <p>Each &if; directive in a source file must be matched by a closing &endif; directive. Any number of &elif; directives can appear between the &if; and &endif; directives, but at most one &else; directive is allowed. The &else; directive, if present, must be the last directive before &endif;.</p>
- <p>The &if;, &elif;, &else;, and &endif; directives can be nested. Each nested &else;, &elif;, or &endif; directive belongs to the closest preceding &if; directive.</p>
- <p>Inline conditional directives may not be mixed with simple. If the &if; directive is simple (occupying a whole line), its associated directives (&elif;, &else;, or &endif;) must also be simple and not inline (appearing inside other lines).</p>
- </description>
- <section title="Examples">
- <pre>
- <line>#define Lang</line>
- <line></line>
- <line>[Tasks]</line>
- <line>#if "English" == Lang = <link href="ReadIni">ReadIni</link>(<link href="SetupSetting">SetupSetting</link>("MessagesFile"), \</line>
- <line>&dsp;"LangOptions", "LanguageName")</line>
- <line>&dsp;Description: "For all users"; Name: all</line>
- <line>#elif "German" == Lang</line>
- <line>&dsp;Description: "Fur alle"; Name: all</line>
- <line>#else</line>
- <line>#&sp;error Unsupported language</line>
- <line>#endif</line>
- </pre>
- </section>
- </topic>
- <topic id="ifdef">
- <title>#ifdef, #ifndef, #ifexist, #ifnexist</title>
- <keywords>
- <kwd>ifdef</kwd>
- <kwd>#ifndef</kwd>
- <kwd>ifndef</kwd>
- <kwd>#ifexist</kwd>
- <kwd>ifexist</kwd>
- <kwd>#ifnexist</kwd>
- <kwd>ifnexist</kwd>
- </keywords>
- <syntax>
- <define id="ifdef-directive">
- <txt>ifdef</txt><nt>ident</nt>
- </define>
- <define id="ifndef-directive">
- <txt>ifndef</txt><nt>ident</nt>
- </define>
- <define id="ifexist-directive">
- <txt>ifexist</txt><nt>expr</nt>
- </define>
- <define id="ifnexist-directive">
- <txt>ifnexist</txt><nt>expr</nt>
- </define>
- </syntax>
- <description>
- <p>You can use the &ifdef;, &ifndef;, &ifexist;, and &ifnexist; directives anywhere &if; can be used. The <tt>ifdef identifier</tt> statement is equivalent to <tt>if 1</tt> when the specified identifier has been defined, and equivalent to <tt>if 0</tt> when the identifier has not been defined or has been undefined with the &undef; directive. These directives check only for the presence or absence of identifiers defined with &define;.</p>
- <p>&ifexist; and &ifnexist; directives check for presence and absence of the file, respectively.</p>
- </description>
- <section title="Examples">
- <pre>
- <line>[Files]</line>
- <line>#ifexist "myfile.ext"</line>
- <line>&dsp;Filename: "myfile.ext"; DestDir: {app}</line>
- <line>#endif</line>
- <line>#ifdef Enterpise</line>
- <line>&dsp;Filename: "extra.dll"; DestDir: {app}</line>
- <line>#endif</line>
- </pre>
- </section>
- <section title="See also">
- <p><link href="FileExists"/></p>
- </section>
- </topic>
- <topic id="for">
- <title>#for</title>
- <keywords><kwd>for</kwd></keywords>
- <syntax>
- <define id="for-directive">
- <txt>for</txt><txt>&sp;</txt><txt>{</txt><nt>expr1</nt><txt>;</txt><nt>expr2</nt><txt>;</txt><nt>expr3</nt><txt>}</txt><nt>expr4</nt>
- </define>
- </syntax>
- <description>
- <p>Use the &for; directive to get loop behaviour. &for; takes 4 expressions. The first expression (<tt>expr1</tt>) is called "initialization expression", the second expression (<tt>expr2</tt>) "condition", the third expression (<tt>expr3</tt>) "action", and the final expression (<tt>expr4</tt>) "loop body".</p>
- <p>The logic the &for; directive follows is:</p>
- <p>&dsp;1. The initialization expression is evaluated.</p>
- <p>&dsp;2. The condition is evaluated. If it evaluates to 0, the loop ends.</p>
- <p>&dsp;3. The loop body is evaluated.</p>
- <p>&dsp;4. The action is evaluated.</p>
- <p>&dsp;5. Process repeats from 2.</p>
- </description>
- <section title="Examples">
- <pre>
- <line>// Call AddFile user defined procedure 200 times</line>
- <line>#for {i = 200; i > 0; i--} AddFile</line>
- </pre>
- </section>
- <section title="More examples">
- <p><link href="FindFirst"/>, <link href="FileRead"/>.</p>
- </section>
- <section title="See also">
- <p>⊂, &include;.</p>
- </section>
- </topic>
- <topic id="sub">
- <title>#sub, #endsub</title>
- <keywords>
- <kwd>sub</kwd>
- <kwd>#endsub</kwd>
- <kwd>endsub</kwd>
- </keywords>
- <syntax>
- <define id="sub-directive">
- <txt>sub</txt><nt>ident</nt>
- </define>
- <define id="endsub-directive">
- <txt>endsub</txt>
- </define>
- </syntax>
- <description>
- <p>⊂ and &endsub; directives are used to declare a user defined procedure which is a portion of script which may be included later once or several times. You may think of a user defined procedure as being similar to an external file, and a call to a user defined procedure as being similar to inclusion of an external file, except that procedures may also be called from within expressions. Please note that it is strongly not recommended to call procedures which emit several lines to the &translation; from within compound expressions or directives.</p>
- <p>A procedure is called by simply specifying its identifier, with which it was declared.</p>
- <p>A procedure is not processed in any way until it is called, so if any errors exist in its body, they will only pop up when the procedure is called.</p>
- </description>
- <section title="Examples">
- <pre>
- <line>#sub AddFile</line>
- <line>&dsp;#if <link href="Copy">Copy</link>(FileName, 1, 1) == "A"</line>
- <line>&dsp;&dsp;Source: {#FileName}; DestDir: {app}\A</line>
- <line>&dsp;#else</line>
- <line>&dsp;&dsp;Source: {#FileName}; DestDir: {app}</line>
- <line>&dsp;#endif</line>
- <line>#endsub</line>
- </pre>
- </section>
- <section title="More examples">
- <p><link href="FindFirst"/>, <link href="FileRead"/>.</p>
- </section>
- <section title="See also">
- <p><link href="macros"/>, &if;, &emit;.</p>
- </section>
- </topic>
- <topic id="pragma">
- <title>#pragma</title>
- <keywords>
- <kwd>pragma</kwd>
- <kwd>option</kwd>
- <kwd>parseroption</kwd>
- <kwd>inlinestart</kwd>
- <kwd>inlineend</kwd>
- <kwd>verboselevel</kwd>
- <kwd>spansymbol</kwd>
- </keywords>
- <syntax>
- <define id="pragma-directive">
- <variant><nt name="pragma-option"/></variant>
- <variant><nt name="pragma-itokens"/></variant>
- <variant><nt name="pragma-msg"/></variant>
- <variant><nt name="pragma-verblev"/></variant>
- <variant><nt name="pragma-include"/></variant>
- <variant><nt name="pragma-spansymb"/></variant>
- </define>
- <define id="pragma-option">
- <txt>pragma</txt><group><nt name="opt-parseopt"/></group><nt name="option"/><opt repeated="yes"><nt name="option"/></opt>
- </define>
- <define id="opt-parseopt" inline="yes">
- <cases><case><txt>option</txt></case><case><txt>parseroption</txt></case></cases>
- </define>
- <define id="option" inline="yes">
- <txt>-</txt><nt>letter</nt><group><nt name="plusminus"/></group>
- </define>
- <define id="plusminus" inline="yes">
- <cases><case><txt>+</txt></case><case><txt>-</txt></case></cases>
- </define>
- <define id="pragma-itokens">
- <txt>pragma</txt><group><nt name="pragma-token-id"/></group><nt>expr</nt>
- </define>
- <define id="pragma-token-id" inline="yes">
- <cases><case><txt>inlinestart</txt></case><case><txt>inlineend</txt></case></cases>
- </define>
- <define id="pragma-msg">
- <txt>pragma</txt><group><nt name="pragma-msg-type"/></group><nt>expr</nt>
- </define>
- <define id="pragma-msg-type" inline="yes">
- <cases><case><txt>message</txt></case><case><txt>warning</txt></case><case><txt>error</txt></case></cases>
- </define>
- <define id="pragma-verblev">
- <txt>pragma verboselevel</txt><nt>expr</nt>
- </define>
- <define id="pragma-include">
- <txt>pragma include</txt><nt>expr</nt>
- </define>
- <define id="pragma-spansymb">
- <txt>pragma spansymbol</txt><nt>expr</nt>
- </define>
- </syntax>
- <description>
- <p>&pragma; is a special directive. Please note that if ISPP fails to parse parameters of this directive (because of typo or wrong syntax), no error will occur ‐ only a warning will be issued; this is done for compatibility with other preprocessors, which can have their own syntax of &pragma; directive.</p>
- <p>The "pragma-option" variant of &pragma; directive controls the options which ISPP uses to read the source. Each option has an assigned letter and you specify options by typing group name (<tt>option</tt> or <tt>parseroption</tt>),
- then the letter prefixed by a dash. After the letter a plus must be used to turn the option on and minus turn it off. Multiple options can be specified at once (see syntax).
- The first group of options (<tt>option</tt>) controls the general options, while the second group (<tt>parseroption</tt>) controls options specific to parser. The list of options is provided at the end of this topic.</p>
- <p>The "pragma-itokens" variant is used to specify inline directive terminators: starting and ending, respectively. After the token description keyword (<tt>inlinestart</tt> or <tt>inlineend</tt>) a string type expression must follow. It must not evaluate to an empty string. It is allowed to specify the same token for both starting and ending terminators. By default, <tt>{#</tt> (opening brace and a pound sign) and <tt>}</tt> (closing brace) are assumed.</p>
- <p>The "pramga-msg" variant issues a message of the type specified by the keyword following the directive name. Messages and warnings are sent to the messages window of the compiler. Errors are shown (by the compiler) using message boxes. Expression must be of type string. Also see the &error; directive.</p>
- <p>The "pragma-verblev" variant turns on verbose mode and sets the level of verbosity which controls the importance of messages (see below). Least important messages will show up only when highest verbose level is set.</p>
- <p>The "pragma-include" variant sets the include path. Expression may specify multiple paths delimited with semicolons. The list of these directories is used when ISPP tries to find a file, mentioned in &include; directive.</p>
- <p>The "prama-spansymb" variant sets the symbol used to span multiple lines together. Expression must not evaluate to an empty string. Only first symbol in string is taken.</p>
- </description>
- <section title="ISPP options">
- <table>
- <tr><td>c</td><td>Indicates that the &translation; should be sent to the compiler after preprocessing is done. Default state: on.</td></tr>
- <tr><td>e</td><td>Specifies whether empty lines or lines with only whitespace should be emitted to the &translation;. Default state: on.</td></tr>
- <tr><td>v</td><td>Turns on/off the verbose mode. Default state: off.</td></tr>
- </table>
- </section>
- <section title="Parser options">
- <table>
- <tr><td>b</td><td>Short-circuit boolean evaluation. Default state: on.</td></tr>
- <tr><td>m</td><td>Short-circuit multiplication evaluation. (In "<code>0 * A</code>", <code>A</code> will not be evaluated, since the result of expression is known to be zero.) Default state: off.</td></tr>
- <tr><td>p</td><td>Pascal-style string literals. In off state, uses C-style string literals (with escape sequences). Default state: on.</td></tr>
- <tr><td>u</td><td>Allow undeclared identifiers. If an undefined identifier is encountered, ISPP will raise an error unless this option is turned on, in which case a standalone identifier (the one that does not look like a function call) will be considered void value. Default state: off.</td></tr>
- </table>
- </section>
- <section title="Verbose levels">
- <table>
- <tr><td>0</td><td>Verbosity level messages</td></tr>
- <tr><td>1</td><td>Messages about any temporary files created by #file</td></tr>
- <tr><td>2</td><td>#insert and #append messages</td></tr>
- <tr><td>4</td><td>#dim, #define and #undef messages</td></tr>
- <tr><td>6</td><td>Conditional inclusion messages</td></tr>
- <tr><td>8</td><td>#emit messages</td></tr>
- <tr><td>9</td><td>Macro and functions call messages</td></tr>
- <tr><td>10</td><td><code>Local</code> macro array allocation messages</td></tr>
- </table>
- </section>
- <section title="Examples">
- <pre>
- <line>#pragma parseroption -b- -u+</line>
- <line>#pragma option -c-</line>
- <line>#pragma warning "Variable value is: " + Str(MyVar)</line>
- <line>#pragma option -v+</line>
- <line>#pragma verboselevel 9</line>
- <line>#pragma inlinestart "$("</line>
- <line>#pragma inlineend ")"</line>
- <line>#pragma include __INCLUDE__ + ";D:\INCLUDE"</line>
- <line>#pragma spansymbol "_"</line>
- </pre>
- </section>
- <section title="See also">
- <p><tt><link href="Message">Message</link></tt>, <tt><link href="Warning">Warning</link></tt>, <tt><link href="Error2">Error</link></tt>.</p>
- </section>
- </topic>
- <topic id="error">
- <title>#error</title>
- <keywords><kwd>error</kwd></keywords>
- <syntax>
- <define id="error-directive">
- <txt>error</txt><nt>text</nt>
- </define>
- </syntax>
- <description>
- <p>Causes the Inno Setup compiler to issue an error message with the specified text. Unlike <tt>pragma error</tt>, text in <tt>error</tt> directive is not parsed, so it is recommended to use this directive instead of &pragma; when possible to avoid possible syntax errors that may hide real errors your script is trying to report.</p>
- </description>
- <section title="Examples">
- <pre>
- <line>#if <link href="predefinedvars">VER</link> < EncodeVer(5,4,2)</line>
- <line>&dsp;#error A more recent version of Inno Setup is required to compile this script (5.4.2 or newer)</line>
- <line>#endif</line>
- </pre>
- </section>
- <section title="See also">
- <p>&pragma;, &if;, <tt><link href="Error2">Error</link></tt>.</p>
- </section>
- </topic>
- </topic>
- <!-- FUNCTIONS -->
- <topic id="funcs">
- <title>Support Functions Reference</title>
- <description header="no">
- <p>There are a number of built-in support functions which you can use to perform compile-time actions and/or change your script. For example the following uses ISPP function <link href="GetVersionNumbersString">GetVersionNumbersString</link> to read version info from an EXE and uses the return value of the function to set the <link href="setup_appvername">AppVerName</link> [Setup] section directive using directive &emit;:</p>
- <pre>
- <line>#define MyAppVer <link href="getversionnumbersstring">GetVersionNumbersString</link>(<link href="addbackslash">AddBackslash</link>(<link href="predefinedvars">SourcePath</link>) + "MyProg.exe")</line>
- <line></line>
- <line>[Setup]</line>
- <line>AppVerName=MyProg version {#MyAppVer}</line>
- </pre>
- <p>Built-in support functions can also be called directly from directive &emit;. For example:</p>
- <pre>
- <line>#define MyAppEnterprise</line>
- <line></line>
- <line>[Setup]</line>
- <line>AppName=MyProg{#<link href="defined">Defined</link> MyAppEnterprise?" Enterprise Edition":""}</line>
- <line>AppVersion={#<link href="getversionnumbersstring">GetVersionNumbersString</link>(<link href="addbackslash">AddBackslash</link>(<link href="predefinedvars">SourcePath</link>) + "MyProg.exe")}</line>
- </pre>
- </description>
- <section title="Function prototypes documenting conventions">
- <p>Function prototypes show the function result type, name, and parameters.</p>
- <p>Return and parameter types <tt>int</tt>, <tt>str</tt>, <tt>any</tt>, and <tt>void</tt> respectively specify the integer type, the string type, any type, and the null type. The integer type is a signed 64-bit integer. When the null type is specified as a function result type then the function does not return a value.</p>
- <p>A question mark (<tt>?</tt>) after an parameter type means that the parameter is optional.</p>
- </section>
- <subtopicstitle>Available functions</subtopicstitle>
- <topic id="GetStringFileInfo">
- <title>GetStringFileInfo</title>
- <section title="Prototype">
- <pre>
- <line><b>str</b> GetStringFileInfo(<b>str</b> 1, <b>str</b> 2, <b>int</b>? 3)</line>
- </pre>
- </section>
- <description>
- <p>Retrieves string from specified file's (first parameter) version information resource.</p>
- <p>Second parameter is the name of the version info string-value. This should be one of the predefined strings. Those strings and shortcuts are declared in &builtins;.</p>
- <p>Third optional parameter should specify the language and charset identifier. For example: 0x04BE0409 stands for "English (United States)". If this parameter is omitted, ISPP scans for all available version info blocks to find the value.</p>
- <p>The function returns an empty string, if it was unable to retrieve the desired string-value.</p>
- </description>
- </topic>
- <topic id="Int">
- <title>Int</title>
- <section title="Prototype">
- <pre>
- <line><b>int</b> Int(<b>any</b> 1, <b>int</b>? 2)</line>
- </pre>
- </section>
- <description>
- <p>Converts an expression (first parameter) to its integer representation. If the expression is an integer, the result of the function is the expression value. If the expression is void, the result is 0. If the expression is string, ISPP tries to convert it to integer; if such attempt fails, an error is raised unless second parameter specifies the default result.</p>
- </description>
- </topic>
- <topic id="Str">
- <title>Str</title>
- <section title="Prototype">
- <pre>
- <line><b>str</b> Str(<b>any</b>)</line>
- </pre>
- </section>
- <description>
- <p>Converts an expression to string. If the expression is integer, the result is its string representation. If the expression is void, the result is an empty string. Otherwise the result is the value of the expression.</p>
- </description>
- </topic>
- <topic id="FileExists">
- <title>FileExists</title>
- <section title="Prototype">
- <pre>
- <line><b>int</b> FileExists(<b>str</b>)</line>
- </pre>
- </section>
- <description>
- <p>Returns non-zero value if the specified file exists.</p>
- </description>
- </topic>
- <topic id="DirExists">
- <title>DirExists</title>
- <section title="Prototype">
- <pre>
- <line><b>int</b> DirExists(<b>str</b>)</line>
- </pre>
- </section>
- <description>
- <p>Returns non-zero value if the specified directory exists.</p>
- </description>
- </topic>
- <topic id="ForceDirectories">
- <title>ForceDirectories</title>
- <section title="Prototype">
- <pre>
- <line><b>int</b> ForceDirectories(<b>str</b>)</line>
- </pre>
- </section>
- <description>
- <p>Creates all the directories along the specified directory path all at once. If the first directories in the path do exist, but the latter ones don't, ForceDirectories creates just the ones that don't exist. Returns non-zero value if successful.</p>
- </description>
- </topic>
- <topic id="FileSize">
- <title>FileSize</title>
- <section title="Prototype">
- <pre>
- <line><b>int</b> FileSize(<b>str</b>)</line>
- </pre>
- </section>
- <description>
- <p>Returns size, in bytes, of the specified file. If the file does not exist, the result is -1.</p>
- </description>
- </topic>
- <topic id="ReadIni">
- <title>ReadIni</title>
- <section title="Prototype">
- <pre><line><b>str</b> ReadIni(<b>str</b> 1, <b>str</b> 2, <b>str</b> 3, <b>str</b>? 4)</line></pre>
- </section>
- <description>
- <p>Reads the value from an INI file. Parameter 1 must be the name of the INI file, parameter 2 ‐ the name of a section in the INI file, the third parameter is the key in the section to read. Last optional parameter can be used to provide the default value that will be returned on failure, if it is omitted, an empty string is returned.</p>
- </description>
- </topic>
- <topic id="WriteIni">
- <title>WriteIni</title>
- <section title="Prototype">
- <pre><line><b>void</b> WriteIni(<b>str</b> 1, <b>str</b> 2, <b>str</b> 3, <b>any</b> 4)</line></pre>
- </section>
- <description>
- <p>Writes specified value to an INI file. Parameter 1 is the name of the INI file, parameter 2 ‐ the name of a section in the INI file, parameter 3 ‐ the name of a key in the section. Last parameter should be set to the value you wish to be written to the INI file, it can be of any type.</p>
- </description>
- </topic>
- <topic id="ReadReg">
- <title>ReadReg</title>
- <section title="Prototype">
- <pre><line><b>any</b> ReadReg(<b>int</b> RootKey, <b>str</b> SubKey, <b>str</b>? Name, <b>any</b>? Default)</line></pre>
- </section>
- <description>
- <p>Reads the value of the specified registry key. First parameter is the root key, such as HKEY_LOCAL_MACHINE, HKEY_LOCAL_MACHINE_32 or HKEY_LOCAL_MACHINE_64. Constants for use with this parameter are declared in &builtins; accompanying ISPP. Second parameter specifies a subkey. Third parameter specifies the name of the value, if this parameter is omitted, a default value is assumed. Last optional parameter may be used to specify the default value that will be returned on failure.</p>
- <p>Note that this function can return a value of any type depending on the type of actual value in the registry.</p>
- </description>
- </topic>
- <topic id="Exec">
- <title>Exec</title>
- <section title="Prototype">
- <pre><line><b>int</b> Exec(<b>str</b> Filename, <b>str</b>? Params, <b>str</b>? WorkingDir, <b>int</b>? Wait, <b>int</b>? ShowCmd)</line></pre>
- </section>
- <description>
- <p>Executes specified executable or batch file.</p>
- <p>The Filename parameter specifies the filename of the executable or batch file. If this does not includes quotes then the function will add them automatically. If you have a single string containing both a filename and parameters (e.g. a command line obtained from an UninstallString registry value), you need not separate them yourself; just pass '>' in this parameter, and the full command line in the Params parameter. (Note that when this is done, the function's special platform-independent support for .bat and .cmd files is disabled; it simply passes the specified command line to CreateProcess without any processing.)</p>
- <p>The Params parameter may be used to specify parameters for the process.</p>
- <p>The WorkingDir parameter may be used to specify the working directory of the process. If this is omitted or empty it will try to extract a pathname from the Filename parameter and use that as the initial current directory for the process.</p>
- <p>The Wait parameter may be set to zero if you don't wish to wait for the process to finish, and non-zero otherwise. By default, non-zero value is assumed.</p>
- <p>The ShowCmd parameter may be any of the <tt>SW_*</tt> constants defined in &builtins;. Console programs are always hidden and the ShowCmd parameter only affects GUI programs, so always using <tt>SW_SHOWNORMAL</tt> (the default) instead of <tt>SW_HIDE</tt> is recommended.</p>
- <p>If the Wait parameter is omitted or is non-zero, the function returns the exit code of the process. Otherwise, the function result indicates whether the process has been successfully launched (non-zero for success).</p>
- <p><i>Note: compared to Pascal Scripting's Exec the Wait and ShowCmd parameters are swapped!</i></p>
- </description>
- <section title="See also">
- <p><tt><link href="ExecAndGetFirstLine">ExecAndGetFirstLine</link></tt></p>
- </section>
- </topic>
- <topic id="ExecAndGetFirstLine">
- <title>ExecAndGetFirstLine</title>
- <section title="Prototype">
- <pre><line><b>str</b> ExecAndGetFirstLine(<b>str</b> Filename, <b>str</b>? Params, <b>str</b>? WorkingDir)</line></pre>
- </section>
- <description>
- <p>Executes specified executable or batch file and reads the first non-empty line from its output.</p>
- <p>The Filename parameter specifies the filename of the executable or batch file. If this does not includes quotes then the function will add them automatically. If you have a single string containing both a filename and parameters (e.g. a command line obtained from an UninstallString registry value), you need not separate them yourself; just pass '>' in this parameter, and the full command line in the Params parameter. (Note that when this is done, the function's special platform-independent support for .bat and .cmd files is disabled; it simply passes the specified command line to CreateProcess without any processing.)</p>
- <p>The Params parameter may be used to specify parameters for the process.</p>
- <p>The WorkingDir parameter may be used to specify the working directory of the process. If this is omitted or empty it will try to extract a pathname from the Filename parameter and use that as the initial current directory for the process.</p>
- </description>
- <section title="See also">
- <p><tt><link href="Exec">Exec</link></tt></p>
- </section>
- </topic>
- <topic id="Copy">
- <title>Copy</title>
- <section title="Prototype">
- <pre><line><b>str</b> Copy(<b>str</b> 1, <b>int</b> 2, <b>int</b>? 3)</line></pre>
- </section>
- <description>
- <p>Extracts a substring from a string (first parameter). The 1-based index of the character from which the substring should start is specified by the second parameter. The third parameter specifies the number of characters to take, if it is omitted, all characters up to the end of the string are copied to the result.</p>
- </description>
- </topic>
- <topic id="Pos">
- <title>Pos</title>
- <section title="Prototype">
- <pre><line><b>int</b> Pos(<b>str</b> SubStr, <b>str</b> S)</line></pre>
- </section>
- <description>
- <p>Searches for SubStr within S and returns the first index of SubStr within S, 1-based. If SubStr is not found, <tt>Pos</tt> returns zero. The <tt>Pos</tt> function is case-sensitive.</p>
- </description>
- </topic>
- <topic id="RPos">
- <title>RPos</title>
- <section title="Prototype">
- <pre><line><b>int</b> RPos(<b>str</b> SubStr, <b>str</b> S)</line></pre>
- </section>
- <description>
- <p>Searches for SubStr within S and returns the last index of SubStr within S, 1-based. If SubStr is not found, <tt>RPos</tt> returns zero. The <tt>RPos</tt> function is case-sensitive.</p>
- </description>
- </topic>
- <topic id="Len">
- <title>Len</title>
- <section title="Prototype">
- <pre><line><b>int</b> Len(<b>str</b>)</line></pre>
- </section>
- <description>
- <p>Returns the length of the given string.</p>
- </description>
- </topic>
- <topic id="SaveToFile">
- <title>SaveToFile</title>
- <section title="Prototype">
- <pre><line><b>void</b> SaveToFile(<b>str</b>)</line></pre>
- </section>
- <description>
- <p>Saves &curtrans; to the specified file.</p>
- </description>
- <section title="Example">
- <pre>
- <line>#expr SaveToFile(AddBackslash(SourcePath) + "Preprocessed.iss")</line>
- </pre>
- </section>
- </topic>
- <topic id="Find">
- <title>Find</title>
- <section title="Prototype">
- <pre><line><b>int</b> Find(<b>int</b> StartLine, <b>str</b> Str1, <b>int</b>? Flags1, <b>str</b>? Str2, <b>int</b>? Flags2, <b>str</b>? Str3, <b>int</b>? Flags3)</line></pre>
- </section>
- <description>
- <p>Intended to be used with &insert; directive: returns the 0-based index of the first line in the &translation; matching the specified criteria. Return less than 0 if not match was found.</p>
- <p>First parameter denotes the 0-based index of the line to start the search from, usually it is set to zero.</p>
- <p>Second, fourth, and sixth parameters should specify string(s) to search within each line. Only the first string must be specified, whereas the others may be omitted.</p>
- <p>Third, fifth, and seventh parameters should specify the search flags for each string meaning that first flags parameter specifies flags for the first string, and so on.</p>
- <p>See <link href="find-flags">Find flags</link> topic for the description of the available search flags.</p>
- <p>If any of the 'flags' parameters is omitted but the string parameter preceding it is specified, <tt>FIND_MATCH | FIND_AND</tt> (i. e. 0) is used.</p>
- </description>
- <section title="See also">
- <p>&insert;.</p>
- </section>
- <topic id="find-flags">
- <title>Find flags</title>
- <description>
- <p>One of the following four values must be specified:</p>
- <p><tt>FIND_MATCH</tt> (0) means that the line must match the search string.</p>
- <p><tt>FIND_BEGINS</tt> (1) means that the line must start with the search string.</p>
- <p><tt>FIND_ENDS</tt> (2) means that the line must end with the search string.</p>
- <p><tt>FIND_CONTAINS</tt> (3) means that the line must contain (i. e. it also can match, begin, or end with) the search string.</p>
- <p>Any of the following modifiers may be combined with one of the previous using bitwise OR operator (<tt>|</tt>):</p>
- <p><tt>FIND_CASESENSITIVE</tt> (4) means that comparison must be case-sensitive.</p>
- <p><tt>FIND_AND</tt> (0) means that this criterium (the pair of parameters in <tt>Find</tt> function) must be met as well as previous criteria. Has no effect for the first criterium.</p>
- <p><tt>FIND_OR</tt> (8) means that it is allowed that this criterium is tested even if previous criteria were not met. Has no effect for the first criterium.</p>
- <p><tt>FIND_NOT</tt> (16) means that this criterium must not be met.</p>
- <p><tt>FIND_AND</tt> and <tt>FIND_OR</tt> are mutually exclusive. If both are specified, <tt>FIND_OR</tt> takes precedence.</p>
- <p>Special flags:</p>
- <p><tt>FIND_TRIM</tt> (32) means that leading and trailing whitespaces must be stripped off from the line prior to testing it against all the criteria. This flag can only be used for the first criterium, and has no effect if used for the others. It is not mutually exclusive with any of the previously mentioned flags.</p>
- </description>
- </topic>
- </topic>
- <topic id="SetupSetting">
- <title>SetupSetting</title>
- <section title="Prototype">
- <pre><line><b>str</b> SetupSetting(<b>str</b>)</line></pre>
- </section>
- <description>
- <p>Parses <link href="setupsection">[Setup] section</link> in &curtrans; to find the key whose name is specified as function parameter. Function returns the value of that key if it's found, or an empty string otherwise.</p>
- </description>
- </topic>
- <topic id="SetSetupSetting">
- <title>SetSetupSetting</title>
- <section title="Prototype">
- <pre><line><b>void</b> SetSetupSetting(<b>str</b> 1, <b>str</b> 2)</line></pre>
- </section>
- <description>
- <p>Modifies or generates [Setup] section directive given the key (first parameter) and its value (second parameter).</p>
- <p>If there is no [Setup] section in &curtrans; (it may happen that function is called before that section in a script), its header (as well as directive itself) is generated by this function.</p>
- <p>Please use this function carefully ‐ it should not be called when ISPP is in insert mode (i. e. after &insert; directive).</p>
- </description>
- </topic>
- <topic id="LowerCase">
- <title>LowerCase</title>
- <section title="Prototype">
- <pre><line><b>str</b> LowerCase(<b>str</b>)</line></pre>
- </section>
- <description>
- <p>Returns a string with the same text as the string passed in its parameter, but with all letters converted to lowercase. The conversion affects only 7-bit ASCII characters between 'A' and 'Z'.</p>
- <p>Note: String comparison operators are case-insensitive, so calling LowerCase on strings before comparing is not necessary.</p>
- </description>
- </topic>
- <topic id="UpperCase">
- <title>UpperCase</title>
- <section title="Prototype">
- <pre><line><b>str</b> UpperCase(<b>str</b>)</line></pre>
- </section>
- <description>
- <p>Returns a string with the same text as the string passed in its parameter, but with all letters converted to uppercase. The conversion affects only 7-bit ASCII characters between 'A' and 'Z'.</p>
- </description>
- </topic>
- <topic id="EntryCount">
- <title>EntryCount</title>
- <section title="Prototype">
- <pre><line><b>int</b> EntryCount(<b>str</b>)</line></pre>
- </section>
- <description>
- <p>Returns the total number of entries in specified section in &curtrans;. It does not count empty lines or comments. Function takes care of multiple sections with the same name and counts all of them.</p>
- </description>
- </topic>
- <topic id="GetEnv">
- <title>GetEnv</title>
- <section title="Prototype">
- <pre><line><b>str</b> GetEnv(<b>str</b>)</line></pre>
- </section>
- <description>
- <p>Returns the value of the environment variable whose name is specified as the parameter. Returns an empty string if the variable is not defined.</p>
- </description>
- </topic>
- <topic id="DeleteFile">
- <title>DeleteFile</title>
- <section title="Prototype">
- <pre><line><b>void</b> DeleteFile(<b>str</b>)</line></pre>
- </section>
- <description>
- <p>Marks the specified file for deletion after the compilation has completed. Does not return anything. Also see <tt><link href="DeleteFileNow">DeleteFileNow</link></tt>.</p>
- </description>
- </topic>
- <topic id="DeleteFileNow">
- <title>DeleteFileNow</title>
- <section title="Prototype">
- <pre><line><b>void</b> DeleteFileNow(<b>str</b>)</line></pre>
- </section>
- <description>
- <p>Deletes the specified file. Does not return anything. Also see <tt><link href="DeleteFile">DeleteFile</link></tt>.</p>
- </description>
- </topic>
- <topic id="CopyFile">
- <title>CopyFile</title>
- <section title="Prototype">
- <pre><line><b>void</b> CopyFile(<b>str</b> ExistingFile, <b>str</b> NewFile)</line></pre>
- </section>
- <description>
- <p>Copies ExistingFile to NewFile, preserving time stamp and file attributes. If NewFile already exists, it will be overwritten.</p>
- </description>
- </topic>
- <topic id="FindFirst">
- <title>FindFirst</title>
- <section title="Prototype">
- <pre><line><b>int</b> FindFirst(<b>str</b>, <b>int</b>)</line></pre>
- </section>
- <description>
- <p>Searches the directory specified by first parameter for the first file that matches the file name implied by first parameter and the attributes specified by second parameter. If the file is found, the result is a find handle, that should be used in subsequent calls to <tt><link href="FindGetFileName">FindGetFileName</link></tt>, <tt><link href="FindNext">FindNext</link></tt>, and <tt><link href="FindClose"/></tt> functions, otherwise the return value is 0.</p>
- <p>The first parameter is the directory and file name mask, including wildcard characters. For example, <tt>'.\*.*'</tt> specifies all files in the current directory).</p>
- <p>The second parameter specifies the special files to include in addition to all normal files. Choose from these file attribute constants defined in &builtins; when specifying this parameter:</p>
- <table>
- <tr><td><code>faReadOnly</code></td><td>Read-only files</td></tr>
- <tr><td><code>faHidden</code></td><td>Hidden files</td></tr>
- <tr><td><code>faSysFile</code></td><td>System files</td></tr>
- <tr><td><code>faVolumeID</code></td><td>Volume ID files</td></tr>
- <tr><td><code>faDirectory</code></td><td>Directory files</td></tr>
- <tr><td><code>faArchive</code></td><td>Archive files</td></tr>
- <tr><td><code>faAnyFile</code></td><td>Any file</td></tr>
- </table>
- <p>Attributes can be combined by OR-ing their constants or values. For example, to search for read-only and hidden files in addition to normal files, pass <tt>faReadOnly | faHidden</tt> as the parameter.</p>
- <!--para><tt>FindFirst</tt> allocates resources which must be released by calling <tt>FindClose</tt>, but only if <tt>FindFirst</tt> returned non-zero value.</para-->
- </description>
- <section title="Example">
- <pre>
- <line>[Files]</line>
- <line>#define FindHandle</line>
- <line>#define FindResult</line>
- <line>#define Mask "*.pas"</line>
- <line></line>
- <line>#sub ProcessFoundFile</line>
- <line>&dsp;#define FileName FindGetFileName(FindHandle)</line>
- <line>&dsp;#if Copy(FileName, 1, 4) == "ispp"</line>
- <line>&dsp;&dsp;Source: {#FileName}; DestDir: {app}\ispp</line>
- <line>&dsp;#else</line>
- <line>&dsp;&dsp;Source: {#FileName}; DestDir: {app}</line>
- <line>&dsp;#endif</line>
- <line>#endsub</line>
- <line></line>
- <line>#for {FindHandle = FindResult = FindFirst(Mask, 0); FindResult; FindResult = FindNext(FindHandle)} ProcessFoundFile</line>
- <line>#if FindHandle</line>
- <line>&dsp;#expr FindClose(FindHandle)</line>
- <line>#endif</line>
- </pre>
- </section>
- <section title="See also">
- <p>&define;, ⊂, &if;.</p>
- </section>
- </topic>
- <topic id="FindNext">
- <title>FindNext</title>
- <section title="Prototype">
- <pre><line><b>int</b> FindNext(<b>int</b>)</line></pre>
- </section>
- <description>
- <p>Returns the next entry that matches the name and attributes specified in a previous call to <tt><link href="FindFirst">FindFirst</link></tt>. The parameter must be a find handle returned by <tt>FindFirst</tt>. The return value is non-zero if the function was successful.</p>
- </description>
- </topic>
- <topic id="FindClose">
- <title>FindClose</title>
- <section title="Prototype">
- <pre><line><b>void</b> FindClose(<b>int</b>)</line></pre>
- </section>
- <description>
- <p>Terminates a <tt><link href="FindFirst">FindFirst</link></tt>/<tt><link href="FindNext">FindNext</link></tt> sequence. The parameter must be a non-zero find handle returned by <tt>FindFirst</tt>.</p>
- <p>This function is obsolete since 1.2. ISPP automatically frees resources allocated in a call to <tt>FindFirst</tt>.</p>
- </description>
- </topic>
- <topic id="FindGetFileName">
- <title>FindGetFileName</title>
- <section title="Prototype">
- <pre><line><b>str</b> FindGetFileName(<b>int</b>)</line></pre>
- </section>
- <description>
- <p>Feed <tt>FindGetFileName</tt> with the find handle returned by <tt><link href="FindFirst">FindFirst</link></tt> to get the name of the file found by the last call to <tt>FindFirst</tt> or <tt><link href="FindNext">FindNext</link></tt>.</p>
- </description>
- </topic>
- <topic id="FileOpen">
- <title>FileOpen</title>
- <section title="Prototype">
- <pre><line><b>int</b> FileOpen(<b>str</b>)</line></pre>
- </section>
- <description>
- <p>Opens a text file for reading and returns the file handle (or zero on failure) to be used in subsequent calls to <tt>File*</tt> functions.</p>
- <!--para><tt>FileOpen</tt> allocates resources which must be released by calling <tt><link href="FileClose">FileClose</link></tt>.</para-->
- </description>
- </topic>
- <topic id="FileRead">
- <title>FileRead</title>
- <section title="Prototype">
- <pre><line><b>str</b> FileRead(<b>int</b>)</line></pre>
- </section>
- <description>
- <p>Reads the next line in a text file opened with <tt><link href="FileOpen">FileOpen</link></tt>. The only parameter should be the file handle returned by <tt>FileOpen</tt>.</p>
- </description>
- <section title="Example">
- <pre>
- <line>#define FileHandle</line>
- <line>#define FileLine</line>
- <line>#sub ProcessFileLine</line>
- <line>&dsp;#define FileLine = FileRead(FileHandle)</line>
- <line>&dsp;#pragma message FileLine</line>
- <line>#endsub</line>
- <line>#for {FileHandle = FileOpen(AddBackslash(CompilerPath) + "whatsnew.htm"); \</line>
- <line>&dsp;FileHandle && !<link href="FileEof">FileEof</link>(FileHandle); ""} \</line>
- <line>&dsp;ProcessFileLine</line>
- <line>#if FileHandle</line>
- <line>&dsp;#expr <link href="FileClose">FileClose</link>(FileHandle)</line>
- <line>#endif</line>
- </pre>
- </section>
- <section title="See also">
- <p>&define;, ⊂, &pragma;, &for;, &if;.</p>
- </section>
- </topic>
- <topic id="FileReset">
- <title>FileReset</title>
- <section title="Prototype">
- <pre><line><b>void</b> FileReset(<b>int</b>)</line></pre>
- </section>
- <description>
- <p>Resets the file pointer to zero, so the subsequent call to <tt><link href="FileRead">FileRead</link></tt> will read the first line of the file. The only parameter should be the file handle returned by <tt><link href="FileOpen">FileOpen</link></tt>.</p>
- </description>
- </topic>
- <topic id="FileEof">
- <title>FileEof</title>
- <section title="Prototype">
- <pre><line><b>int</b> FileEof(<b>int</b>)</line></pre>
- </section>
- <description>
- <p>Returns zero if the file pointer does not point to the end of the file, or non-zero otherwise. If this function returns non-zero value, subsequent calls to <tt><link href="FileRead">FileRead</link></tt> will fail. The only parameter should be the file handle returned by <tt><link href="FileOpen">FileOpen</link></tt>.</p>
- </description>
- </topic>
- <topic id="FileClose">
- <title>FileClose</title>
- <section title="Prototype">
- <pre><line><b>void</b> FileClose(<b>int</b>)</line></pre>
- </section>
- <description>
- <p>Closes a file opened using <tt><link href="FileOpen">FileOpen</link></tt>. After calling <tt>FileClose</tt>, the file handle becomes invalid.</p>
- <p>Note: opened files which are not closed using this function will be automatically closed after the script has been preprocessed.</p>
- </description>
- </topic>
- <topic id="SaveStringToFile">
- <title>SaveStringToFile</title>
- <section title="Prototype">
- <pre><line><b>int</b> SaveStringToFile(<b>str</b> Filename, <b>str</b> S, <b>int</b>? Append, <b>int</b>? UTF8)</line></pre>
- </section>
- <description>
- <p>Saves the specified string to the specified file. If Append is non-zero or ommitted and the specified file already exists, it will be appended to instead of overwritten. If UTF8 is non-zero or ommitted, the string will be saved with UTF8 encoding instead of ASCII encoding. Returns non-zero if successful, or zero otherwise.</p>
- <p>This function does not automatically write a line break before or after the string. If Append is non-zero or ommitted and the existing file did not end in a line break, the function will effectively append to the existing last line. To avoid this you can put line break characters (using <tt><link href="predefinedvars">NewLine</link></tt>) before and/or after your string.</p>
- </description>
- <section title="Example">
- <pre>
- <line>#expr SaveStringToFile('c:\filename.txt', NewLine + 'the string' + NewLine)</line>
- </pre>
- </section>
- </topic>
- <topic id="GetDateTimeString">
- <title>GetDateTimeString</title>
- <section title="Prototype">
- <pre><line><b>str</b> GetDateTimeString(<b>str</b> DateTimeFormat, <b>str</b>? DateSeparator, <b>str</b>? TimeSeparator)</line></pre>
- </section>
- <description>
- <p>Returns the current date and time as a string using the specified formatting.</p>
- <p>The first parameter is the format string. The second and third parameters are optional and denote the DateSeparator and TimeSeparator parameters explained below.</p>
- <p>The following format specifiers are supported:</p>
- <table>
- <tr><td>d</td><td>Displays the day as a number without a leading zero (1-31).</td></tr>
- <tr><td>dd</td><td>Displays the day as a number with a leading zero (01-31).</td></tr>
- <tr><td>ddd</td><td>Displays the day as an abbreviation (Sun-Sat).</td></tr>
- <tr><td>dddd</td><td>Displays the day as a full name (Sunday-Saturday).</td></tr>
- <tr><td>ddddd</td><td>Displays the date using the system's short date format.</td></tr>
- <tr><td>dddddd</td><td>Displays the date using the system's long date format.</td></tr>
- <tr><td>m</td><td>Displays the month as a number without a leading zero (1-12). If the m specifier immediately follows an h or hh specifier, the minute rather than the month is displayed.</td></tr>
- <tr><td>mm</td><td>Displays the month as a number with a leading zero (01-12). If the mm specifier immediately follows an h or hh specifier, the minute rather than the month is displayed.</td></tr>
- <tr><td>mmm</td><td>Displays the month as an abbreviation (Jan-Dec).</td></tr>
- <tr><td>mmmm</td><td>Displays the month as a full name (January-December).</td></tr>
- <tr><td>yy</td><td>Displays the year as a two-digit number (00-99).</td></tr>
- <tr><td>yyyy</td><td>Displays the year as a four-digit number (0000-9999).</td></tr>
- <tr><td>h</td><td>Displays the hour without a leading zero (0-23).</td></tr>
- <tr><td>hh</td><td>Displays the hour with a leading zero (00-23).</td></tr>
- <tr><td>n</td><td>Displays the minute without a leading zero (0-59).</td></tr>
- <tr><td>nn</td><td>Displays the minute with a leading zero (00-59).</td></tr>
- <tr><td>s</td><td>Displays the second without a leading zero (0-59).</td></tr>
- <tr><td>ss</td><td>Displays the second with a leading zero (00-59).</td></tr>
- <tr><td>t</td><td>Displays the time using the system's short time format.</td></tr>
- <tr><td>tt</td><td>Displays the time using the system's long time format.</td></tr>
- <tr><td>am/pm</td><td>Uses the 12-hour clock for the preceding h or hh specifier. Displays 'am' for any hour before noon, and 'pm' for any hour after noon. The am/pm specifier can use lower, upper, or mixed case, and the result is displayed accordingly.</td></tr>
- <tr><td>a/p</td><td>Uses the 12-hour clock for the preceding h or hh specifier. Displays 'a' for any hour before noon, and 'p' for any hour after noon. The a/p specifier can use lower, upper, or mixed case, and the result is displayed accordingly.</td></tr>
- <tr><td>/</td><td>Displays the date separator character given by the DateSeparator parameter. If DateSeparator is set to an empty string, the system's date separator character will be used instead.</td></tr>
- <tr><td>:</td><td>Displays the time separator character given by the TimeSeparator parameter. If TimeSeparator is set to an empty string, the system's time separator character will be used instead.</td></tr>
- <tr><td>'xx'/"xx"</td><td>Characters enclosed in single or double quotes are displayed as-is, and do not affect formatting.</td></tr>
- </table>
- <p>Format specifiers may be written in upper case as well as in lower case letters--both produce the same result.</p>
- </description>
- <section title="Example">
- <pre>
- <line>#define MyDateTimeString GetDateTimeString('ddddd')</line>
- <line>#define MyDateTimeString GetDateTimeString('ddddd tt')</line>
- <line>#define MyDateTimeString GetDateTimeString('dd/mm/yyyy hh:nn:ss', '-', ':')</line>
- </pre>
- </section>
- <section title="See also">
- <p><tt><link href="GetFileDateTimeString">GetFileDateTimeString</link></tt></p>
- </section>
- </topic>
- <topic id="GetFileDateTimeString">
- <title>GetFileDateTimeString</title>
- <section title="Prototype">
- <pre><line><b>str</b> GetFileDateTimeString(<b>str</b> Filename, <b>str</b> DateTimeFormat, <b>str</b>? DateSeparator, <b>str</b>? TimeSeparator)</line></pre>
- </section>
- <description>
- <p>Returns the date and time of the specified file as a string using the specified formatting.</p>
- <p>The first parameter is the file name. The second parameter denotes the format string. The third and fourth parameters are optional and denote the DateSeparator and TimeSeparator parameters as explained in the <link href="GetDateTimeString">GetDateTimeString</link> topic.</p>
- </description>
- <section title="Example">
- <pre>
- <line>#define MyFileDateTimeString GetFileDateTimeString('myfile.txt', 'dd/mm/yyyy hh:nn:ss', '-', ':');</line>
- </pre>
- </section>
- <section title="See also">
- <p><tt><link href="GetDateTimeString">GetDateTimeString</link></tt></p>
- </section>
- </topic>
- <topic id="GetMD5OfString">
- <title>GetMD5OfString</title>
- <section title="Prototype">
- <pre><line><b>str</b> GetMD5OfString(<b>str</b>)</line></pre>
- </section>
- <description>
- <p>Gets the MD5 sum of the specified ANSI string, as a string.</p>
- </description>
- <section title="Example">
- <pre>
- <line>#define MD5 GetMD5OfString('Test')</line>
- <line>// MD5 = '0cbc6611f5540bd0809a388dc95a615b'</line>
- </pre>
- </section>
- </topic>
- <topic id="GetMD5OfUnicodeString">
- <title>GetMD5OfUnicodeString</title>
- <section title="Prototype">
- <pre><line><b>str</b> GetMD5OfString(<b>str</b>)</line></pre>
- </section>
- <description>
- <p>Gets the MD5 sum of the specified Unicode string, as a string.</p>
- </description>
- <section title="Example">
- <pre>
- <line>#define MD5 GetMD5OfUnicodeString('Test')</line>
- <line>// MD5 = '8e06915d5f5d4f8754f51892d884c477'</line>
- </pre>
- </section>
- </topic>
- <topic id="GetMD5OfFile">
- <title>GetMD5OfFile</title>
- <section title="Prototype">
- <pre><line><b>str</b> GetMD5OfFile(<b>str</b>)</line></pre>
- </section>
- <description>
- <p>Gets the MD5 sum of the specified file, as a string.</p>
- </description>
- </topic>
- <topic id="GetSHA1OfString">
- <title>GetSHA1OfString</title>
- <section title="Prototype">
- <pre><line><b>str</b> GetSHA1OfString(<b>str</b>)</line></pre>
- </section>
- <description>
- <p>Gets the SHA-1 hash of the specified ANSI string, as a string.</p>
- </description>
- <section title="Example">
- <pre>
- <line>#define SHA1 GetSHA1OfString('Test')</line>
- <line>// SHA1 = '640ab2bae07bedc4c163f679a746f7ab7fb5d1fa'</line>
- </pre>
- </section>
- </topic>
- <topic id="GetSHA1OfUnicodeString">
- <title>GetSHA1OfUnicodeString</title>
- <section title="Prototype">
- <pre><line><b>str</b> GetSHA1OfUnicodeString(<b>str</b>)</line></pre>
- </section>
- <description>
- <p>Gets the SHA-1 hash of the specified Unicode string, as a string.</p>
- </description>
- <section title="Example">
- <pre>
- <line>#define SHA1 GetSHA1OfUnicodeString('Test')</line>
- <line>// SHA1 = '9ab696a37604d665dc97134dbee44cfe70451b1a'</line>
- </pre>
- </section>
- </topic>
- <topic id="GetSHA1OfFile">
- <title>GetSHA1OfFile</title>
- <section title="Prototype">
- <pre><line><b>str</b> GetSHA1OfFile(<b>str</b>)</line></pre>
- </section>
- <description>
- <p>Gets the SHA-1 hash of the specified file, as a string.</p>
- </description>
- </topic>
- <topic id="GetSHA256OfString">
- <title>GetSHA256OfString</title>
- <section title="Prototype">
- <pre><line><b>str</b> GetSHA256OfString(<b>str</b>)</line></pre>
- </section>
- <description>
- <p>Gets the SHA-256 hash of the specified ANSI string, as a string.</p>
- </description>
- <section title="Example">
- <pre>
- <line>#define SHA256 GetSHA256OfString('Test')</line>
- <line>// SHA256 = '532eaabd9574880dbf76b9b8cc00832c20a6ec113d682299550d7a6e0f345e25'</line>
- </pre>
- </section>
- </topic>
- <topic id="GetSHA256OfUnicodeString">
- <title>GetSHA256OfUnicodeString</title>
- <section title="Prototype">
- <pre><line><b>str</b> GetSHA256OfUnicodeString(<b>str</b>)</line></pre>
- </section>
- <description>
- <p>Gets the SHA-256 hash of the specified Unicode string, as a string.</p>
- </description>
- <section title="Example">
- <pre>
- <line>#define SHA256 GetSHA256OfUnicodeString('Test')</line>
- <line>// SHA256 = 'e6fa3ca87b1b641ab646d3b4933bba8d0970763f030b6578a60abdeae7366247'</line>
- </pre>
- </section>
- </topic>
- <topic id="GetSHA256OfFile">
- <title>GetSHA256OfFile</title>
- <section title="Prototype">
- <pre><line><b>str</b> GetSHA256OfFile(<b>str</b>)</line></pre>
- </section>
- <description>
- <p>Gets the SHA-256 hash of the specified file, as a string.</p>
- </description>
- </topic>
- <topic id="Trim">
- <title>Trim</title>
- <section title="Prototype">
- <pre><line><b>str</b> Trim(<b>str</b>)</line></pre>
- </section>
- <description>
- <p>Returns a copy of the specified string without leading and trailing spaces.</p>
- </description>
- </topic>
- <topic id="StringChange">
- <title>StringChange</title>
- <section title="Prototype">
- <pre><line><b>str</b> StringChange(<b>str</b>, <b>str</b>, <b>str</b>)</line></pre>
- </section>
- <description>
- <p>Returns a copy of the first string, with all occurrences of the second string changed to the third string.</p>
- </description>
- <section title="Example">
- <pre>
- <line>#define MyString "a ca c"</line>
- <line>#define MyString2 StringChange(MyString, " ", "b")</line>
- <line>// MyString2 = 'abcabc'</line>
- </pre>
- </section>
- </topic>
- <topic id="IsWin64">
- <title>IsWin64</title>
- <section title="Prototype">
- <pre><line><b>int</b> IsWin64()</line></pre>
- </section>
- <description>
- <p>Returns non-zero if the system is running a 64-bit version of Windows that provides the API support Inno Setup requires to perform 64-bit installation tasks, or zero otherwise.</p>
- </description>
- </topic>
- <topic id="Defined">
- <title>Defined</title>
- <section title="Prototype">
- <pre>
- <line><b>int</b> Defined(<ident>)</line>
- <line><b>int</b> Defined <ident></line>
- </pre>
- </section>
- <description>
- <p>Special function. Returns non-zero if the specified identifier is defined with &define; directive.</p>
- <p>Using parentheses is optional.</p>
- </description>
- </topic>
- <topic id="TypeOf">
- <title>TypeOf</title>
- <section title="Prototype">
- <pre>
- <line><b>int</b> TypeOf(<ident>)</line>
- <line><b>int</b> TypeOf <ident></line>
- </pre>
- </section>
- <description>
- <p>Special function. Returns one of predefined TypeOf constants which are declared in &builtins; for the specified identifier.</p>
- <p>Using parentheses is optional.</p>
- </description>
- </topic>
- <topic id="DimOf">
- <title>DimOf</title>
- <section title="Prototype">
- <pre>
- <line><b>int</b> DimOf(<ident>)</line>
- <line><b>int</b> DimOf <ident></line>
- </pre>
- </section>
- <description>
- <p>Special function. Returns the dimension of the specified identifier.</p>
- <p>Using parentheses is optional.</p>
- </description>
- <section title="See also">
- <p>&dim;, &redim;.</p>
- </section>
- </topic>
- <topic id="GetVersionNumbers">
- <title>GetVersionNumbers</title>
- <section title="Prototype">
- <pre>
- <line><b>str</b> GetVersionNumbers(<b>str</b> Filename, <b>int</b> *VersionMS, <b>int</b> *VersionLS)</line>
- </pre>
- </section>
- <description>
- <p>Gets the version numbers of the specified file. Returns the version as a string (in "0.0.0.0" format) if successful, an empty string otherwise.</p>
- <p>Declared in &builtins;.</p>
- </description>
- <section title="See also">
- <p><tt><link href="PackVersionNumbers">PackVersionNumbers</link></tt></p>
- </section>
- </topic>
- <topic id="GetVersionComponents">
- <title>GetVersionComponents</title>
- <section title="Prototype">
- <pre>
- <line><b>str</b> GetVersionComponents(<b>str</b> Filename, <b>int</b> *Major, <b>int</b> *Minor, <b>int</b> *Revision, <b>int</b> *Build)</line>
- </pre>
- </section>
- <description>
- <p>Gets the individual version components of the specified file. Returns the version as a string (in "0.0.0.0" format) if successful, an empty string otherwise.</p>
- <p>Declared in &builtins;.</p>
- </description>
- <section title="See also">
- <p><tt><link href="PackVersionComponents">PackVersionComponents</link></tt></p>
- </section>
- </topic>
- <topic id="GetVersionNumbersString">
- <title>GetVersionNumbersString</title>
- <section title="Prototype">
- <pre>
- <line><b>str</b> GetVersionNumbersString(<b>str</b> Filename)</line>
- </pre>
- </section>
- <description>
- <p>Returns the version of the specified file as a string (in "0.0.0.0" format) if successful, an empty string otherwise.</p>
- <p>Also see <link href="GetStringFileInfo">GetStringFileInfo</link>, which can also be used to retrieve file versions using "FileVersion" or "ProductVersion" as the second parameter. The difference is that GetVersionNumbersString takes it from the fixed block of version info, unlike GetStringFileInfo which extracts string from the language specific block.</p>
- </description>
- </topic>
- <topic id="GetPackedVersion">
- <title>GetPackedVersion</title>
- <section title="Prototype">
- <pre>
- <line><b>str</b> GetPackedVersion(<b>str</b> Filename, <b>int</b> *Version)</line>
- </pre>
- </section>
- <description>
- <p>Gets the packed version of the specified file. Returns the version as a string (in "0.0.0.0" format) if successful, an empty string otherwise.</p>
- <p>Always use <tt><link href="ComparePackedVersion">ComparePackedVersion</link></tt> or <tt><link href="SamePackedVersion">SamePackedVersion</link></tt> to compare packed versions.</p>
- <p>Declared in &builtins;.</p>
- </description>
- <section title="See also">
- <p><tt><link href="PackVersionComponents">PackVersionComponents</link></tt></p>
- </section>
- </topic>
- <topic id="PackVersionNumbers">
- <title>PackVersionNumbers</title>
- <section title="Prototype">
- <pre>
- <line><b>int</b> PackVersionNumbers(<b>int</b> VersionMS, <b>int</b> VersionLS)</line>
- </pre>
- </section>
- <description>
- <p>Packs version numbers into a single value.</p>
- <p>Always use <tt><link href="ComparePackedVersion">ComparePackedVersion</link></tt> or <tt><link href="SamePackedVersion">SamePackedVersion</link></tt> to compare packed versions.</p>
- <p>Declared in &builtins;.</p>
- </description>
- <section title="See also">
- <p><tt><link href="GetVersionNumbers">GetVersionNumbers</link></tt>, <tt><link href="PackVersionComponents">PackVersionComponents</link></tt>, <tt><link href="UnpackVersionNumbers">UnpackVersionNumbers</link></tt></p>
- </section>
- </topic>
- <topic id="PackVersionComponents">
- <title>PackVersionComponents</title>
- <section title="Prototype">
- <pre>
- <line><b>int</b> PackVersionComponents(<b>int</b> Major, <b>int</b> Minor, <b>int</b> Revision, <b>int</b> Build)</line>
- </pre>
- </section>
- <description>
- <p>Packs individual version components into a single value.</p>
- <p>Always use <tt><link href="ComparePackedVersion">ComparePackedVersion</link></tt> or <tt><link href="SamePackedVersion">SamePackedVersion</link></tt> to compare packed versions.</p>
- <p>Declared in &builtins;.</p>
- </description>
- <section title="See also">
- <p><tt><link href="GetVersionComponents">GetVersionComponents</link></tt>, <tt><link href="PackVersionNumbers">PackVersionNumbers</link></tt>, <tt><link href="UnpackVersionComponents">UnpackVersionComponents</link></tt></p>
- </section>
- </topic>
- <topic id="ComparePackedVersion">
- <title>ComparePackedVersion</title>
- <section title="Prototype">
- <pre>
- <line><b>int</b> ComparePackedVersion(<b>int</b> Version1, <b>int</b> Version2)</line>
- </pre>
- </section>
- <description>
- <p>Compares Version1 to Version2. The return value is less than 0 if Version1 is less than Version2, 0 if Version1 equals Version2, or greater than 0 if Version1 is greater than Version2.</p>
- </description>
- </topic>
- <topic id="SamePackedVersion">
- <title>SamePackedVersion</title>
- <section title="Prototype">
- <pre>
- <line><b>int</b> SamePackedVersion(<b>int</b> Version1, <b>int</b> Version2)</line>
- </pre>
- </section>
- <description>
- <p>Compares the packed versions Version1 and Version2 and returns non-zero if they are equal.</p>
- </description>
- </topic>
- <topic id="UnpackVersionNumbers">
- <title>UnpackVersionNumbers</title>
- <section title="Prototype">
- <pre>
- <line><b>void</b> UnpackVersionNumbers(<b>int</b> Version, <b>int</b> *VersionMS, <b>int</b> *VersionLS)</line>
- </pre>
- </section>
- <description>
- <p>Unpacks a packed version into version numbers.</p>
- <p>Declared in &builtins;.</p>
- </description>
- <section title="See also">
- <p><tt><link href="UnpackVersionComponents">UnpackVersionComponents</link></tt>, <tt><link href="PackVersionNumbers">PackVersionNumbers</link></tt></p>
- </section>
- </topic>
- <topic id="UnpackVersionComponents">
- <title>UnpackVersionComponents</title>
- <section title="Prototype">
- <pre>
- <line><b>void</b> UnpackVersionComponents(<b>int</b> Version, <b>int</b> *Major, <b>int</b> *Minor, <b>int</b> *Revision, <b>int</b> *Build)</line>
- </pre>
- </section>
- <description>
- <p>Unpacks a packed version into individual version components.</p>
- <p>Declared in &builtins;.</p>
- </description>
- <section title="See also">
- <p><tt><link href="UnpackVersionNumbers">UnpackVersionNumbers</link></tt>, <tt><link href="PackVersionComponents">PackVersionComponents</link></tt></p>
- </section>
- </topic>
- <topic id="VersionToStr">
- <title>VersionToStr</title>
- <section title="Prototype">
- <pre>
- <line><b>void</b> VersionToStr(<b>int</b> Version)</line>
- </pre>
- </section>
- <description>
- <p>Returns the specified packed version as a string (in "0.0.0.0" format).</p>
- <p>Declared in &builtins;.</p>
- </description>
- <section title="See also">
- <p><tt><link href="StrToVersion">StrToVersion</link></tt>, <tt><link href="UnpackVersionNumbers">UnpackVersionNumbers</link></tt>, <tt><link href="UnpackVersionComponents">UnpackVersionComponents</link></tt></p>
- </section>
- </topic>
- <topic id="StrToVersion">
- <title>StrToVersion</title>
- <section title="Prototype">
- <pre>
- <line><b>int</b> StrToVersion(<b>str</b> Version)</line>
- </pre>
- </section>
- <description>
- <p>Returns the specified string (in "0.0.0.0" format) as a packed version.</p>
- <p>Declared in &builtins;.</p>
- </description>
- <section title="See also">
- <p><tt><link href="VersionToStr">VersionToStr</link></tt>, <tt><link href="PackVersionNumbers">PackVersionNumbers</link></tt>, <tt><link href="PackVersionComponents">PackVersionComponents</link></tt></p>
- </section>
- </topic>
- <topic id="EncodeVer">
- <title>EncodeVer</title>
- <section title="Prototype">
- <pre>
- <line><b>int</b> EncodeVer(<b>int</b> Major, <b>int</b> Minor, <b>int</b> Revision = 0, <b>int</b> Build = -1)</line>
- </pre>
- </section>
- <description>
- <p>Returns given four version elements encoded to a 32 bit integer number (8 bits for each element, i.e. elements must be within 0...255 range).</p>
- <p>Declared in &builtins;.</p>
- </description>
- </topic>
- <topic id="DecodeVer">
- <title>DecodeVer</title>
- <section title="Prototype">
- <pre>
- <line><b>str</b> DecodeVer(<b>int</b> Version, <b>int</b> Digits = 3)</line>
- </pre>
- </section>
- <description>
- <p>Returns given 32 bit integer encoded version decoded to its string representation. The Digits parameter indicates how many elements to show (if the fourth element is 0, it won't be shown anyway).</p>
- <p>Declared in &builtins;.</p>
- </description>
- </topic>
- <topic id="FindSection">
- <title>FindSection</title>
- <section title="Prototype">
- <pre>
- <line><b>int</b> FindSection(<b>str</b> Section = "Files")</line>
- </pre>
- </section>
- <description>
- <p>Returns the 0-based index of the line following the header of the section, or less than 0 if the section was not found. This function is intended to be used with &insert; directive.</p>
- <p>Declared in &builtins;.</p>
- </description>
- </topic>
- <topic id="FindSectionEnd">
- <title>FindSectionEnd</title>
- <section title="Prototype">
- <pre>
- <line><b>int</b> FindSectionEnd(<b>str</b> Section = "Files")</line>
- </pre>
- </section>
- <description>
- <p>Returns the 0-based index of the line following last entry of the section, or less than 0 if the section was not found. This function is intended to be used with #insert directive.</p>
- <p>Declared in &builtins;.</p>
- </description>
- </topic>
- <topic id="FindCode">
- <title>FindCode</title>
- <section title="Prototype">
- <pre>
- <line><b>int</b> FindCode()</line>
- </pre>
- </section>
- <description>
- <p>Returns the 0-based index of the line following either the [Code] section header, or the "program" keyword, if any. Returns less than 0 if neither is found.</p>
- <p>Declared in &builtins;.</p>
- </description>
- </topic>
- <topic id="ExtractFilePath">
- <title>ExtractFilePath</title>
- <section title="Prototype">
- <pre>
- <line><b>str</b> ExtractFilePath(<b>str</b> PathName)</line>
- </pre>
- </section>
- <description>
- <p>Returns the directory portion of the given filename, including a trailing backslash. If PathName doesn't contain a directory portion, the result is an empty string.</p>
- <p>Declared in &builtins;.</p>
- </description>
- <section title="See also">
- <p><tt><link href="ExtractFileDir">ExtractFileDir</link></tt></p>
- </section>
- </topic>
- <topic id="ExtractFileDir">
- <title>ExtractFileDir</title>
- <section title="Prototype">
- <pre>
- <line><b>str</b> ExtractFileDir(<b>str</b> PathName)</line>
- </pre>
- </section>
- <description>
- <p>Returns the directory portion of the given filename, excluding a trailing backslash (unless it is a root directory). If PathName doesn't contain a directory portion, the result is an empty string.</p>
- <p>Declared in &builtins;.</p>
- </description>
- <section title="See also">
- <p><tt><link href="ExtractFilePath">ExtractFilePath</link></tt></p>
- </section>
- </topic>
- <topic id="ExtractFileExt">
- <title>ExtractFileExt</title>
- <section title="Prototype">
- <pre>
- <line><b>str</b> ExtractFileExt(<b>str</b> PathName)</line>
- </pre>
- </section>
- <description>
- <p>Returns the extension portion of the given filename, NOT including the period character.</p>
- <p>Declared in &builtins;.</p>
- </description>
- </topic>
- <topic id="ExtractFileName">
- <title>ExtractFileName</title>
- <section title="Prototype">
- <pre>
- <line><b>str</b> ExtractFileName(<b>str</b> PathName)</line>
- </pre>
- </section>
- <description>
- <p>Returns the name portion of the given filename. If PathName ends with a backslash, the result is an empty string.</p>
- <p>Declared in &builtins;.</p>
- </description>
- </topic>
- <topic id="ChangeFileExt">
- <title>ChangeFileExt</title>
- <section title="Prototype">
- <pre>
- <line><b>str</b> ChangeFileExt(<b>str</b> FileName, <b>str</b> NewExt)</line>
- </pre>
- </section>
- <description>
- <p>Changes the extension in FileName with NewExt. NewExt must not contain period.</p>
- <p>Declared in &builtins;.</p>
- </description>
- </topic>
- <topic id="RemoveFileExt">
- <title>RemoveFileExt</title>
- <section title="Prototype">
- <pre>
- <line><b>void</b> RemoveFileExt(<b>str</b> FileName)</line>
- </pre>
- </section>
- <description>
- <p>Removes the extension in FileName.</p>
- <p>Declared in &builtins;.</p>
- </description>
- </topic>
- <topic id="AddBackslash">
- <title>AddBackslash</title>
- <section title="Prototype">
- <pre>
- <line><b>str</b> AddBackslash(<b>str</b> S)</line>
- </pre>
- </section>
- <description>
- <p>Appends a backslash to the string, if it's not already there, and returns the result.</p>
- <p>Declared in &builtins;.</p>
- </description>
- </topic>
- <topic id="RemoveBackslashUnlessRoot">
- <title>RemoveBackslashUnlessRoot</title>
- <section title="Prototype">
- <pre>
- <line><b>str</b> RemoveBackslashUnlessRoot(<b>str</b> S)</line>
- </pre>
- </section>
- <description>
- <p>Removes the trailing backslash from the string unless the string points to a root directory, and returns the result.</p>
- <p>Declared in &builtins;.</p>
- </description>
- </topic>
- <topic id="Delete">
- <title>Delete</title>
- <section title="Prototype">
- <pre>
- <line><b>void</b> Delete(<b>str</b> *S, <b>int</b> Index, <b>int</b> Count = MaxInt)</line>
- </pre>
- </section>
- <description>
- <p>Deletes the specified number of characters beginning with Index from S. S is passed by reference (therefore is modified).</p>
- <p>Declared in &builtins;.</p>
- </description>
- </topic>
- <topic id="Insert2">
- <title>Insert</title>
- <section title="Prototype">
- <pre>
- <line><b>void</b> Insert(<b>str</b> *S, <b>int</b> Index, <b>str</b> Substr)</line>
- </pre>
- </section>
- <description>
- <p>Inserts specified Substr at Index'th character into S. S is passed by reference (therefore is modified).</p>
- <p>Declared in &builtins;.</p>
- </description>
- </topic>
- <topic id="YesNo">
- <title>YesNo</title>
- <section title="Prototype">
- <pre>
- <line><b>int</b> YesNo(<b>str</b> S)</line>
- </pre>
- </section>
- <description>
- <p>Returns non-zero if given string is "yes", "true" or "1". Intended to be used with the <tt><link href="SetupSetting">SetupSetting</link></tt> function.</p>
- <p>Declared in &builtins;.</p>
- </description>
- </topic>
- <topic id="Power">
- <title>Power</title>
- <section title="Prototype">
- <pre>
- <line><b>int</b> Power(<b>int</b> X, <b>int</b> P = 2)</line>
- </pre>
- </section>
- <description>
- <p>Declared in &builtins;.</p>
- </description>
- </topic>
- <topic id="Min">
- <title>Min</title>
- <section title="Prototype">
- <pre>
- <line><b>int</b> Min(<b>int</b> A, <b>int</b> B, <b>int</b> C = MaxInt)</line>
- </pre>
- </section>
- <description>
- <p>Declared in &builtins;.</p>
- </description>
- </topic>
- <topic id="Max">
- <title>Max</title>
- <section title="Prototype">
- <pre>
- <line><b>int</b> Max(<b>int</b> A, <b>int</b> B, <b>int</b> C = MinInt)</line>
- </pre>
- </section>
- <description>
- <p>Declared in &builtins;.</p>
- </description>
- </topic>
- <topic id="SameText">
- <title>SameText</title>
- <section title="Prototype">
- <pre>
- <line><b>int</b> SameText(<b>str</b> S1, <b>str</b> S2)</line>
- </pre>
- </section>
- <description>
- <p>Returns non-zero if the given strings are identical, ignoring case.</p>
- <p>Declared in &builtins;.</p>
- </description>
- </topic>
- <topic id="SameStr">
- <title>SameStr</title>
- <section title="Prototype">
- <pre>
- <line><b>int</b> SameStr(<b>str</b> S1, <b>str</b> S2)</line>
- </pre>
- </section>
- <description>
- <p>Returns non-zero if the given strings are identical, with case-sensitivity.</p>
- </description>
- </topic>
- <topic id="Message">
- <title>Message</title>
- <section title="Prototype">
- <pre>
- <line><b>void</b> Message(<b>str</b> S)</line>
- </pre>
- </section>
- <description>
- <p>Functional version of <tt><link href="pragma">pragma message</link></tt>.</p>
- </description>
- </topic>
- <topic id="Warning">
- <title>Warning</title>
- <section title="Prototype">
- <pre>
- <line><b>void</b> Warning(<b>str</b> S)</line>
- </pre>
- </section>
- <description>
- <p>Functional version of <tt><link href="pragma">pragma warning</link></tt>.</p>
- </description>
- </topic>
- <topic id="Error2">
- <title>Error</title>
- <section title="Prototype">
- <pre>
- <line><b>void</b> Error(<b>str</b> S)</line>
- </pre>
- </section>
- <description>
- <p>Functional version of &error;.</p>
- </description>
- </topic>
- <topic id="AddQuotes">
- <title>AddQuotes</title>
- <section title="Prototype">
- <pre>
- <line><b>str</b> AddQuotes(<b>str</b> S)</line>
- </pre>
- </section>
- <description>
- <p>Adds a quote (") character to the left and right sides of the string if the string contains a space and it didn't have quotes already. This is primarily used when spawning another process with a long filename as one of the parameters.</p>
- </description>
- </topic>
- <topic id="Is64BitPEImage">
- <title>Is64BitPEImage</title>
- <section title="Prototype">
- <pre>
- <line><b>int</b> Is64BitPEImage(<b>str</b> FileName)</line>
- </pre>
- </section>
- <description>
- <p>Returns non-zero if the specified file is a non-32-bit PE image, zero otherwise.</p>
- </description>
- </topic>
- <topic id="EmitLanguagesSection">
- <title>EmitLanguagesSection</title>
- <section title="Prototype">
- <pre>
- <line><b>void</b> EmitLanguagesSection</line>
- </pre>
- </section>
- <description>
- <p>Emits a full <tt>[Languages]</tt> section for all available official languages, including English.</p>
- <p>After compilation, see tab <i>Preprocessor Output</i> in the Compiler IDE for the full list of available languages, including their generated names.</p>
- <p>Declared in &builtins;.</p>
- </description>
- <section title="Example">
- <pre>
- <line>#expr EmitLanguagesSection</line>
- </pre>
- </section>
- </topic>
- </topic>
- <topic id="macros">
- <keywords>
- <kwd>#define</kwd>
- <kwd>define</kwd>
- <kwd>Functions</kwd>
- <kwd>Local</kwd>
- </keywords>
- <title>User Defined Functions</title>
- <description header="no">
- <p>You can define user defined functions.</p>
- <p>A user defined function declaration consists of a formal parameter list and an expression. That expression is evaluated when the function is called (see below). The result of the function call is the result of the expression. The expression can contain parameter names, they are treated as usual variables.</p>
- <p>The formal syntax of a user defined function is provided in &define; and &builtins; contains many example functions.</p>
- <p>Please note that there must be no space between the function name and opening parenthesis.</p>
- <p>Actual parameters for parameters declared as by-reference must be modifiable l-values (in other words, other defined variables or expressions that evaluate to l-values). If the expression modifies by-reference parameter, the variable that is passed as this parameter gets modified. By-value parameters can also be modified by the expression (using assignment operators), but this modification doesn't affect the value of a variable which could be passed as this parameter.</p>
- <p>Though a user defined function can only contain one expression, sequential evaluation operators (comma), assignment operators (simple and compound) and conditional operators (<tt>?:</tt>) can be used to build more complicated functions.</p>
- </description>
- <section title="Local array">
- <p>In context of the expression, an additional array named <tt>Local</tt> is valid. Its elements can be used for temporary storage and reusing values in sequential expressions. Values stored in <tt>Local</tt> array are neither preserved from call to call (including recursive), nor are they accessible from anywhere except the expression.</p>
- <pre>
- <line>#define DeleteToFirstPeriod(str *S) /* user defined function declaration */ \</line>
- <line>&dsp;Local[1] = <link href="copy">Copy</link>(S, 1, (Local[0] = <link href="pos">Pos</link>(".", S)) - 1), \</line>
- <line>&dsp;S = Copy(S, Local[0] + 1), \</line>
- <line>&dsp;Local[1]</line>
- </pre>
- </section>
- </topic>
- <!-- EXPRESSIONS -->
- <topic id="expressions">
- <keywords>
- <kwd>Data types</kwd>
- <kwd>Types</kwd>
- <kwd>Comments</kwd>
- </keywords>
- <title>Expression Syntax</title>
- <description header="no">
- <p>ISPP uses C/C++-like expression syntax. It supports simple and compound assignment operators, conditional operator, and sequential evaluation operator. Although ISPP is an interpreter, it does support short circuit boolean evaluation and never evaluates expressions (nor calls any user defined functions mentioned in those expressions) that should not be evaluated due to specific rules (for example, when conditional operator is used, always only 2 out of 3 operands are evaluated).</p>
- <p>&builtins; contains many example expressions.</p>
- </description>
- <section title="Differences between C and ISPP expression syntax">
- <ul>
- <li>ISPP does not support a number of operators (reference, dereference, namespace resolution, member selection, etc.).</li>
- <li>ISPP treats an identifier and the equality sign as a name of an parameter, if it is used in parameter list.</li>
- <li>Arithmetic division operator (slash) performs integer division, since ISPP does not support floating point math.</li>
- <li>ISPP does not check for validity of expressions in certain cases. For example, in conditional expression, "true" operand can be of string type, whereas "false" operand can be of integer type.</li>
- <li>String literals can be quoted by both single and double quotes (in both modes ‐ C-style or Pascal-style). If a literal begins with a single quote, it must also end with a single quote. Double quotes may be used in single quoted string without any escaping, and vice versa. Within a string, the character used to quote the string must be escaped (the manner depends on current state of "Pascal-style string literals" parser option, see &pragma;). Also see predefined variable <tt><link href="predefinedvars">NewLine</link></tt>.</li>
- </ul>
- </section>
- <section title="Data types">
- <p>There are three types in ISPP: void, integer, and string. Variable of void type is declared by just specifying its name after &define; directive without any value. Such variables should be used with &ifdef; directive or <tt><link href="Defined">Defined</link></tt> function.</p>
- <p>If "allow undeclared identifiers" parser option is off (the default state, see &pragma;), an error is raised when undefined variable is mentioned. Otherwise, it will be treated as a value of type void.</p>
- <p>Void is compatible with integer and string in expressions. For example, you can use addition operator with void and integer operands, in this case void operand will be treated as zero. In conjunction with string, void operand is treated as an empty string.</p>
- <p>String comparison operators are case-insensitive.</p>
- </section>
- <section title="Comments">
- <p>Comments may be embedded in an expression by using a slash and an asterisk. For example:</p>
- <pre>
- <line>#emit Var1 /* this is a comment */ + Var2 /* this is also a comment */</line>
- </pre>
- <p>Comments may also be placed at the end of an expression by using a semicolon or two slashes. For example:</p>
- <pre>
- <line>#emit Var1 + Var2 ; this is a comment</line>
- <line>#emit Var1 + Var2 // this is also comment</line>
- </pre>
- <p>Please note that line spanning feature is triggered before any further processing, so this is also a valid comment:</p>
- <pre>
- <line>#emit Var1 + Var2 ; this is \</line>
- <line>&dsp;still a comment</line>
- </pre>
- <p>Comments may also be placed anywhere by starting a line with two slashes. For example:</p>
- <pre>
- <line>// This is a comment</line>
- </pre>
- <p>All of the comments listed above are not included in the &translation;, unlike (non ISPP) comments using a semicolon at the start of a line. For example:</p>
- <pre>
- <line>#emit Var1 + Var2 ; this comment is not included</line>
- <line>// This comment is not included</line>
- <line>; This comment IS included</line>
- </pre>
- </section>
- <section title="Extended User Defined Function Call Syntax">
- <p>In ISPP, it is possible to use named parameters when calling user defined function. Given the declaration:</p>
- <pre>
- <line>#define MyFunction(int A = 2, int B = 2) A + B</line>
- </pre>
- <p>This function can be called specifying parameter names:</p>
- <pre>
- <line>#emit MyFunction(A = 5, B = 10)</line>
- <line>#emit MyFunction(B = 3)</line>
- <line>#emit MyFunction(B = 10, A = 5)</line>
- </pre>
- <ul>
- <li>If a name is specified for one parameter, then all (required) parameters in the list must also be named.</li>
- <li>The order of named parameters does not matter.</li>
- <li>
- <p>Because of this extension, an assignment expression must be enclosed in parentheses, if not using extended call syntax, to avoid ambiguity:</p>
- <pre>
- <line>#emit MyFunction((MyVar = 5), 10)</line>
- </pre>
- <p>In the above example, the equality sign is treated as a direct assignment operator.</p>
- <p>Although functions do not have named parameters, it is still required to enclose assignment expressions in parentheses when calling those functions.</p>
- </li>
- <li>
- <p>By standard rule, comma is used to separate actual parameters. If you need to use sequential evaluation operator, you must include the expression in parentheses:</p>
- <pre>
- <line>#emit MyFunction((SaveToFile("script.txt"), 5), 10)</line>
- </pre>
- <p>In the above example, the first comma is treated as the sequential evaluation operator, whereas the second one as the parameter delimiter.</p>
- </li>
- </ul>
- </section>
- </topic>
- <topic id="predefinedvars">
- <keywords>
- <kwd>__COUNTER__</kwd>
- <kwd>__FILENAME__</kwd>
- <kwd>__INCLUDE__</kwd>
- <kwd>__LINE__</kwd>
- <kwd>__OPT_X__</kwd>
- <kwd>__DIR__</kwd>
- <kwd>__PATHFILENAME__</kwd>
- <kwd>__POPT_X__</kwd>
- <kwd>__WIN32__</kwd>
- <kwd>ISPP_INVOKED</kwd>
- <kwd>ISCC_INVOKED</kwd>
- <kwd>PREPROCVER</kwd>
- <kwd>WINDOWS</kwd>
- <kwd>UNICODE</kwd>
- <kwd>CompilerPath</kwd>
- <kwd>SourcePath</kwd>
- <kwd>Ver</kwd>
- <kwd>NewLine</kwd>
- <kwd>Tab</kwd>
- </keywords>
- <title>Predefined Variables</title>
- <description header="no">
- <p>There are a number of predefined variables provided ISPP:</p>
- <table>
- <tr><td><code>__COUNTER__</code></td><td><code><b>int</b></code>. Automatically increments each time it is used (afterwards).</td></tr>
- <tr><td><code>__FILENAME__</code></td><td><code><b>str</b></code>. Similar to __PATHFILENAME__, but returns only the filename portion.</td></tr>
- <tr><td><code>__INCLUDE__</code></td><td><code><b>str</b></code>. Returns the current include path (or paths delimited with semicolons) set via <code>#pragma include</code>.</td></tr>
- <tr><td><code>__LINE__</code></td><td><code><b>int</b></code>. Returns the number of the line in the current file.</td></tr>
- <tr><td><code>__OPT_X__</code></td><td><code><b>void</b></code>. Defined if specified option set via <code>#pragma option -x+</code> is in effect. In place of "X" may be any letter from "A" to "Z". Use <link href="defined">Defined</link> function to test whether the variable is defined.</td></tr>
- <tr><td><code>__DIR__</code></td><td><code><b>str</b></code>. Similar to __PATHFILENAME__, but returns only the directory portion, excluding a trailing backslash (unless it is a root directory).</td></tr>
- <tr><td><code>__PATHFILENAME__</code></td><td><code><b>str</b></code>. Returns the full path of the current include file. Empty string for the root script file.</td></tr>
- <tr><td><code>__POPT_X__</code></td><td><code><b>void</b></code>. Defined if specified parser option set via <code>#pragma parseroption -x+</code> is in effect. In place of "X" may be any letter from "A" to "Z". Use <link href="defined">Defined</link> function to test whether the variable is defined.</td></tr>
- <tr><td><code>__WIN32__</code></td><td><code><b>void</b></code>. Always defined.</td></tr>
- <tr><td><code>ISPP_INVOKED</code></td><td><code><b>void</b></code>. Always defined.</td></tr>
- <tr><td><code>ISCC_INVOKED</code></td><td><code><b>void</b></code>. Defined if compilation was invoked using the console-mode compiler, ISCC.exe.</td></tr>
- <tr><td><code>PREPROCVER</code></td><td><code><b>int</b></code>. Returns the 32-bit encoded version of ISPP. Highest byte holds the major version, lowest byte holds the build number.</td></tr>
- <tr><td><code>WINDOWS</code></td><td><code><b>void</b></code>. Always defined.</td></tr>
- <tr><td><code>UNICODE</code></td><td><code><b>void</b></code>. Always defined.</td></tr>
- <tr><td><code>CompilerPath</code></td><td><code><b>str</b></code>. Points to the directory where the compiler is located.</td></tr>
- <tr><td><code>SourcePath</code></td><td><code><b>str</b></code>. Points to the directory where the root script file is located, or the My Documents directory if the script has not yet been saved.</td></tr>
- <tr><td><code>Ver</code></td><td><code><b>int</b></code>. Returns the 32-bit encoded version of Inno Setup compiler. Highest byte holds the major version, lowest byte the minor version.</td></tr>
- <tr><td><code>NewLine</code></td><td><code><b>str</b></code>. Returns the newline character. Declared in &builtins;.</td></tr>
- <tr><td><code>Tab</code></td><td><code><b>str</b></code>. Returns the tab character. Declared in &builtins;.</td></tr>
- </table>
- </description>
- </topic>
- <topic id="linespan">
- <title>Line Spanning</title>
- <description header="no">
- <p>By ending lines with ISPP's line spanning symbol preceded with a space, you can split long lines. For example:</p>
- <pre>
- <line>#define MyAppName \</line>
- <line>&dsp;"My Program"</line>
- </pre>
- <p>The default line spanning symbol is "\" which can be changed using &pragma;.</p>
- </description>
- </topic>
- <topic id="visibility">
- <keywords>
- <kwd>private</kwd>
- <kwd>protected</kwd>
- <kwd>public</kwd>
- <kwd>visibility</kwd>
- </keywords>
- <title>Visibility of Identifiers</title>
- <description header="no">
- <p>Variables (as well as user defined functions, read "variable or user defined function" anywhere it says "variable" below) can be explicitly defined as "public", "protected", or "private". To define such a variable, its name in its &define; directive should be prepended with one of the visibility keywords:</p>
- <pre>
- <line>#define public MyVar 12</line>
- <line>#define protected MyVar 13</line>
- <line>#define private MyVar 14</line>
- </pre>
- <p>In the example above, none of the last two declarations undefine any of the previous, though they share the same identifier (<tt>MyVar</tt>). This is because they are declared in different visibilities.</p>
- <p>Public variables are ordinary variables accessible from anywhere after the point they are declared.</p>
- <p>Protected variables are accessible only in the file they are declared in and in files included by that file via &include; or &file; directives. You can basically think of them as public variables which are automatically undefined once their file has finished.</p>
- <p>Private variables are accessible only in the file they are declared in. They are not propagated to any other file, be it included or "parent" file.</p>
- <p>Since ISPP does not have semantics of pushing and popping variable value, visibility resolution can be useful.</p>
- <p>Note that you cannot explicitly refer to a variable in a specific visibility from expressions. Given the example above, if <tt>MyVar</tt> is mentioned in expression in declaration file, its identifier refers to private <tt>MyVar</tt>. If it is mentioned in included file, it refers to protected <tt>MyVar</tt>. If it is mentioned in one of the files above the declaration file on the include stack (i. e. one of the files from which a chain of &include; directives resulted in processing the declaration file), it refers to public <tt>MyVar</tt>.</p>
- <p>Also note, that if we'd swap last two declarations from the above example, private <tt>MyVar</tt> would become inaccessible (until protected is undefined) because protected would be declared after it and would take precedence. But it wouldn't undefine its private counterpart.</p>
- <p>Each file can set a default visibility, the visibility that will be used when no resolution clause is specified in variable declaration. This can be done using &define; directive, for example:</p>
- <pre><line>#define protected</line></pre>
- <p>sets protected visibility by default.</p>
- <p>The default visibility isn't used when evaluating expressions, it is only used when a variable is defined or undefined without explicitly specifying its visibility. When default visibility is not set, public is assumed by default. Setting default visibility is not propagated on included or parent files.</p>
- <p>In user defined function expressions, avoid using identifiers of lower visibility than the one the user defined function is declared in. This may cause "Undeclared identifier" errors if the user defined function is called from another file.</p>
- <p>It is recommended that you use appropriate visibility when declaring variables to avoid problems with unexpected redefinition of a variable (for example in included third-party file). If no included files depend on a variable, declare it as private. If they do, but the parent file doesn't, declare it as protected. Declare it as public otherwise. If you're unsure, then protected visibility is the common case.</p>
- </description>
- </topic>
- <topic id="example">
- <title>Example Script</title>
- <description header="no">
- <p>An example script called <i>ISPPExample1.iss</i> is located in a separate folder. Please click the "Inno Setup Example Scripts" shortcut created in the Start Menu when you installed Inno Setup, or open the "Examples" folder in your Inno Setup directory.</p>
- <p>Also see &builtins;.</p>
- </description>
- </topic>
- <topic id="builtinsiss">
- <title>ISPPBuiltins.iss</title>
- <description header="no">
- <p>The ISPPBuiltins.iss file is part of Inno Setup Preprocessor and is automatically installed to root of your Inno Setup folder. This file is automatically included at the start of preprocessing: some of ISPP's functions are actually implemented by this file instead of being built-in. It also contains common declarations such as special constants. The file is a regular Inno Setup Script file so you can use all of its techniques in your own script as well.</p>
- </description>
- </topic>
- <topic id="isppcc">
- <title>Extended Command Line Compiler</title>
- <description header="no">
- <p>The <link href="compilercmdline">console-mode compiler</link> (ISCC.exe) provides extra parameters to control Inno Setup Preprocessor:</p>
- <table>
- <tr><td>/D<name>[=<value>]</td><td>Emulate <code>#define public <name> <value></code></td></tr>
- <tr><td>/$<letter>(+|-)</td><td>Emulate <code>#pragma option -<letter>(+|-)</code></td></tr>
- <tr><td>/P<letter>(+|-)</td><td>Emulate <code>#pragma parseroption -<letter>(+|-)</code></td></tr>
- <tr><td>/I<paths></td><td>Emulate <code>#pragma include <paths></code></td></tr>
- <tr><td>/J<filename></td><td>Emulate <code>#include <filename></code></td></tr>
- <tr><td>/{#<string></td><td>Emulate <code>#pragma inlinestart <string></code></td></tr>
- <tr><td>/}<string></td><td>Emulate <code>#pragma inlineend <string></code></td></tr>
- <tr><td>/V<number></td><td>Emulate <code>#pragma verboselevel <number></code></td></tr>
- </table>
- <p>Example: <tt>iscc /$c- /Pu+ "/DLicenseFile=Trial License.txt" /Ic:\inc;d:\inc /Jdefines.iss "c:\isetup\samples\my script.iss"</tt></p>
- </description>
- </topic>
- <topic id="translation" unlisted="yes">
- <title>Preprocessor output</title>
- <description header="no">
- <p>Preprocessor output refers to the preprocessed version of the script.</p>
- </description>
- </topic>
- <topic id="current-translation" unlisted="yes">
- <title>Current preprocessor output</title>
- <description header="no">
- <p>Current preprocessor output refers to the &translation; up to the line which ISPP is currently processing.</p>
- </description>
- </topic>
- <!--topic id="tricks">
- <title>Secondary ISPP features</title>
- <description header="no">
- <p>Since ISPP is not a script engine, many useful language constructs are not supported directly. But some results can be achieved using existing features of ISPP.</p>
- </description>
- <topic id="looping">
- <title>Looping</title>
- <description header="no">
- <p>ISPP allows you to call macro recursively, i. e. call it from itself. This feature can be used to emulate loop.</p>
- <p>For example, you wish to construct a "for"-like loop. To achieve this, you'll need to declare a macro that takes one integer parameter and which makes the loop "body". After that you declare "outer" loop, which is used for iterating:</p>
- <pre>
- <line>#define LoopBody(int I) Str(I) + "th iteration\n"</line>
- <line></line>
- <line>#define Loop(int LoopRoof = 10) \ </line>
- <line>&dsp;LoopRoof ?&sp;&dsp;&dsp;&dsp;&dsp;&dsp;&dsp;/* if LoopTop is not zero */ \</line>
- <line>&dsp;&dsp;LoopBody(LoopRoof) +&sp;/* call the body */ \ </line>
- <line>&dsp;&dsp;Loop(LoopRoof - 1)&sp;&dsp;/* next iteration*/ \</line>
- <line>&dsp;:&dsp;&dsp;&dsp;&dsp;&dsp;&dsp;&dsp;&dsp;&dsp;&dsp;&dsp;/* else */ \</line>
- <line>&dsp;&dsp;""&dsp;&dsp;&dsp;&dsp;&dsp;&dsp;&dsp;&dsp;&dsp;&sp;/* return empty string */</line>
- </pre>
- <p>With these two macros declared, this command:</p>
- <pre>
- <line>#emit Loop(LoopRoof = 5)</line>
- </pre>
- <p>will produce</p>
- <pre>
- <line>5th iteration</line>
- <line>4th iteration</line>
- <line>3th iteration</line>
- <line>2th iteration</line>
- <line>1th iteration</line>
- </pre>
- <p>Note that this example emits text to translation, therefore it should use concatenation operator (<tt>+</tt>) with loop body and next iteration. If the loop body does not produce any output, it is recommended to use sequential evaluation operator (<tt>,</tt> - comma).</p>
- </description>
- </topic>
- </topic-->
- </topic>
- </yasyx>
|