VirtualBox

Changeset 2167 in kBuild for trunk


Ignore:
Timestamp:
Dec 30, 2008 4:45:46 PM (16 years ago)
Author:
bird
Message:

kmk-qr: kmk-expressions.

Location:
trunk/kBuild/doc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/kBuild/doc/QuickReference-kmk.html

    r2166 r2167  
    294294<h1 class="title">kmk Quick Reference</h1>
    295295<p>This is an attempt at summarizing all directives, functions, special variables,
    296 special targets, built-in commands, external commands, and <tt class="docutils literal"><span class="pre">kmk</span></tt> expressions.
     296special targets, built-in commands, external commands, and <tt class="docutils literal"><span class="pre">kmk</span></tt>-expressions.
    297297Since <em>all</em> the features are included, the quickness of this reference can be
    298298disputed. ;-)</p>
     
    877877$(intersects set-a, set-b)
    878878</pre>
    879 <p>Same as <tt class="docutils literal"><span class="pre">$(if</span> <span class="pre">)</span></tt> execpt that the condition is a <tt class="docutils literal"><span class="pre">kmk</span></tt> expression:</p>
     879<p>Same as <tt class="docutils literal"><span class="pre">$(if</span> <span class="pre">)</span></tt> execpt that the condition is a <tt class="docutils literal"><span class="pre">kmk</span></tt>-expression:</p>
    880880<pre class="literal-block">
    881881$(if-expr kmk-expression,true-part[,false-part])
    882882</pre>
    883 <p>Select the first true condition (<tt class="docutils literal"><span class="pre">kmk</span></tt> expression) and expand the
     883<p>Select the first true condition (<tt class="docutils literal"><span class="pre">kmk</span></tt>-expression) and expand the
    884884following body. Special condition strings <tt class="docutils literal"><span class="pre">default</span></tt> and <tt class="docutils literal"><span class="pre">otherwise</span></tt>:</p>
    885885<pre class="literal-block">
    886886$(select when1-cond, when1-body[, whenN-cond, whenN-body])
    887887</pre>
    888 <p>Evalutate the <tt class="docutils literal"><span class="pre">kmk</span></tt> expression returning what it evalues as. This is
     888<p>Evalutate the <tt class="docutils literal"><span class="pre">kmk-expression</span></tt> returning what it evalues as. This is
    889889the preferred way of doing arithmentic now:</p>
    890890<pre class="literal-block">
     
    12221222<div class="section">
    12231223<h1><a id="kmk-expression" name="kmk-expression">kmk-expression</a></h1>
    1224 <p>todo</p>
     1224<p><tt class="docutils literal"><span class="pre">kmk</span></tt>-expressions are related to the C/C++ preprocessor in some ways as well
     1225as <tt class="docutils literal"><span class="pre">nmake</span></tt> and BSD <tt class="docutils literal"><span class="pre">make</span></tt>. There are however some peculiarities because of
     1226the way GNU <tt class="docutils literal"><span class="pre">make</span></tt> choose to represent booleans in its function library, so,
     1227strings can be turned into boolean by taking any non-empty string as true.</p>
     1228<p>Quoting using single quotes results in hard strings, while double quotes and
     1229unquoted string results in soft strings that can be converted to number or
     1230boolean to fit the situation.</p>
     1231<p>Here's the operator table in decending precedence order:</p>
     1232<table border="1" class="docutils">
     1233<colgroup>
     1234<col width="20%" />
     1235<col width="11%" />
     1236<col width="70%" />
     1237</colgroup>
     1238<thead valign="bottom">
     1239<tr><th class="head">Operator</th>
     1240<th class="head">Type</th>
     1241<th class="head">Description</th>
     1242</tr>
     1243</thead>
     1244<tbody valign="top">
     1245<tr><td><tt class="docutils literal"><span class="pre">defined</span></tt></td>
     1246<td rowspan="6">Unary</td>
     1247<td>Checks if the following variable exists.</td>
     1248</tr>
     1249<tr><td><tt class="docutils literal"><span class="pre">exists</span></tt></td>
     1250<td>Checks if the following file exists.</td>
     1251</tr>
     1252<tr><td><tt class="docutils literal"><span class="pre">target</span></tt></td>
     1253<td>Checks if the following target exists.</td>
     1254</tr>
     1255<tr><td><tt class="docutils literal"><span class="pre">bool</span></tt></td>
     1256<td>Casts the following value to boolean.</td>
     1257</tr>
     1258<tr><td><tt class="docutils literal"><span class="pre">num</span></tt></td>
     1259<td>Casts the following value to a number.</td>
     1260</tr>
     1261<tr><td><tt class="docutils literal"><span class="pre">str</span></tt></td>
     1262<td>Casts the following value to a string.</td>
     1263</tr>
     1264<tr><td><tt class="docutils literal"><span class="pre">!</span></tt></td>
     1265<td rowspan="4">Unary</td>
     1266<td>Logical NOT.</td>
     1267</tr>
     1268<tr><td><tt class="docutils literal"><span class="pre">+</span></tt></td>
     1269<td>Pluss prefix.</td>
     1270</tr>
     1271<tr><td><tt class="docutils literal"><span class="pre">-</span></tt></td>
     1272<td>Minus prefix.</td>
     1273</tr>
     1274<tr><td><tt class="docutils literal"><span class="pre">~</span></tt></td>
     1275<td>Bitwise one's complement.</td>
     1276</tr>
     1277<tr><td><tt class="docutils literal"><span class="pre">*</span></tt></td>
     1278<td rowspan="3">Binary</td>
     1279<td>Multiplication (product).</td>
     1280</tr>
     1281<tr><td><tt class="docutils literal"><span class="pre">/</span></tt></td>
     1282<td>Division (quotient).</td>
     1283</tr>
     1284<tr><td><tt class="docutils literal"><span class="pre">%</span></tt></td>
     1285<td>Modulus (remainder).</td>
     1286</tr>
     1287<tr><td><tt class="docutils literal"><span class="pre">+</span></tt></td>
     1288<td rowspan="2">Binary</td>
     1289<td>Addition (sum).</td>
     1290</tr>
     1291<tr><td><tt class="docutils literal"><span class="pre">-</span></tt></td>
     1292<td>Subtraction (difference).</td>
     1293</tr>
     1294<tr><td><tt class="docutils literal"><span class="pre">&lt;&lt;</span></tt></td>
     1295<td rowspan="2">Binary</td>
     1296<td>Bitwise left shift.</td>
     1297</tr>
     1298<tr><td><tt class="docutils literal"><span class="pre">&gt;&gt;</span></tt></td>
     1299<td>Bitwise right shift.</td>
     1300</tr>
     1301<tr><td><tt class="docutils literal"><span class="pre">&lt;=</span></tt></td>
     1302<td rowspan="4">Binary</td>
     1303<td>Less or equal than.</td>
     1304</tr>
     1305<tr><td><tt class="docutils literal"><span class="pre">&lt;</span></tt></td>
     1306<td>Less than.</td>
     1307</tr>
     1308<tr><td><tt class="docutils literal"><span class="pre">&gt;=</span></tt></td>
     1309<td>Greater or equal than.</td>
     1310</tr>
     1311<tr><td><tt class="docutils literal"><span class="pre">&gt;</span></tt></td>
     1312<td>Greater than.</td>
     1313</tr>
     1314<tr><td><tt class="docutils literal"><span class="pre">==</span></tt></td>
     1315<td rowspan="2">Binary</td>
     1316<td>Equal to.</td>
     1317</tr>
     1318<tr><td><tt class="docutils literal"><span class="pre">!=</span></tt></td>
     1319<td>Not equal to.</td>
     1320</tr>
     1321<tr><td><tt class="docutils literal"><span class="pre">&amp;</span></tt></td>
     1322<td>Binary</td>
     1323<td>Bitwise AND.</td>
     1324</tr>
     1325<tr><td><tt class="docutils literal"><span class="pre">^</span></tt></td>
     1326<td>Binary</td>
     1327<td>Bitwise XOR.</td>
     1328</tr>
     1329<tr><td><tt class="docutils literal"><span class="pre">|</span></tt></td>
     1330<td>Binary</td>
     1331<td>Bitwise OR.</td>
     1332</tr>
     1333<tr><td><tt class="docutils literal"><span class="pre">&amp;&amp;</span></tt></td>
     1334<td>Binary</td>
     1335<td>Logical AND.</td>
     1336</tr>
     1337<tr><td><tt class="docutils literal"><span class="pre">||</span></tt></td>
     1338<td>Binary</td>
     1339<td>Logical OR.</td>
     1340</tr>
     1341</tbody>
     1342</table>
    12251343<hr class="docutils" />
    12261344<table class="docutils field-list" frame="void" rules="none">
  • trunk/kBuild/doc/QuickReference-kmk.txt

    r2166 r2167  
    44
    55This is an attempt at summarizing all directives, functions, special variables,
    6 special targets, built-in commands, external commands, and ``kmk`` expressions.
     6special targets, built-in commands, external commands, and ``kmk``-expressions.
    77Since *all* the features are included, the quickness of this reference can be
    88disputed. ;-)
     
    518518        $(intersects set-a, set-b)
    519519
    520     Same as ``$(if )`` execpt that the condition is a ``kmk`` expression::
     520    Same as ``$(if )`` execpt that the condition is a ``kmk``-expression::
    521521
    522522        $(if-expr kmk-expression,true-part[,false-part])
    523523
    524     Select the first true condition (``kmk`` expression) and expand the
     524    Select the first true condition (``kmk``-expression) and expand the
    525525    following body. Special condition strings ``default`` and ``otherwise``::
    526526
    527527        $(select when1-cond, when1-body[, whenN-cond, whenN-body])
    528528
    529     Evalutate the ``kmk`` expression returning what it evalues as. This is
     529    Evalutate the ``kmk-expression`` returning what it evalues as. This is
    530530    the preferred way of doing arithmentic now::
    531531
     
    829829--------------
    830830
    831 todo
     831``kmk``-expressions are related to the C/C++ preprocessor in some ways as well
     832as ``nmake`` and BSD ``make``. There are however some peculiarities because of
     833the way GNU ``make`` choose to represent booleans in its function library, so,
     834strings can be turned into boolean by taking any non-empty string as true.
     835
     836Quoting using single quotes results in hard strings, while double quotes and
     837unquoted string results in soft strings that can be converted to number or
     838boolean to fit the situation.
     839
     840Here's the operator table in decending precedence order:
     841
     842+---------------+--------+-----------------------------------------------------+
     843| Operator      | Type   | Description                                         |
     844+===============+========+=====================================================+
     845| ``defined``   | Unary  | Checks if the following variable exists.            |
     846+---------------+        +-----------------------------------------------------+
     847| ``exists``    |        | Checks if the following file exists.                |
     848+---------------+        +-----------------------------------------------------+
     849| ``target``    |        | Checks if the following target exists.              |
     850+---------------+        +-----------------------------------------------------+
     851| ``bool``      |        | Casts the following value to boolean.               |
     852+---------------+        +-----------------------------------------------------+
     853| ``num``       |        | Casts the following value to a number.              |
     854+---------------+        +-----------------------------------------------------+
     855| ``str``       |        | Casts the following value to a string.              |
     856+---------------+--------+-----------------------------------------------------+
     857| ``!``         | Unary  | Logical NOT.                                        |
     858+---------------+        +-----------------------------------------------------+
     859| ``+``         |        | Pluss prefix.                                       |
     860+---------------+        +-----------------------------------------------------+
     861| ``-``         |        | Minus prefix.                                       |
     862+---------------+        +-----------------------------------------------------+
     863| ``~``         |        | Bitwise one's complement.                           |
     864+---------------+--------+-----------------------------------------------------+
     865| ``*``         | Binary | Multiplication (product).                           |
     866+---------------+        +-----------------------------------------------------+
     867| ``/``         |        | Division (quotient).                                |
     868+---------------+        +-----------------------------------------------------+
     869| ``%``         |        | Modulus (remainder).                                |
     870+---------------+--------+-----------------------------------------------------+
     871| ``+``         | Binary | Addition (sum).                                     |
     872+---------------+        +-----------------------------------------------------+
     873| ``-``         |        | Subtraction (difference).                           |
     874+---------------+--------+-----------------------------------------------------+
     875| ``<<``        | Binary | Bitwise left shift.                                 |
     876+---------------+        +-----------------------------------------------------+
     877| ``>>``        |        | Bitwise right shift.                                |
     878+---------------+--------+-----------------------------------------------------+
     879| ``<=``        | Binary | Less or equal than.                                 |
     880+---------------+        +-----------------------------------------------------+
     881| ``<``         |        | Less than.                                          |
     882+---------------+        +-----------------------------------------------------+
     883| ``>=``        |        | Greater or equal than.                              |
     884+---------------+        +-----------------------------------------------------+
     885| ``>``         |        | Greater than.                                       |
     886+---------------+--------+-----------------------------------------------------+
     887| ``==``        | Binary | Equal to.                                           |
     888+---------------+        +-----------------------------------------------------+
     889| ``!=``        |        | Not equal to.                                       |
     890+---------------+--------+-----------------------------------------------------+
     891| ``&``         | Binary | Bitwise AND.                                        |
     892+---------------+--------+-----------------------------------------------------+
     893| ``^``         | Binary | Bitwise XOR.                                        |
     894+---------------+--------+-----------------------------------------------------+
     895| ``|``         | Binary | Bitwise OR.                                         |
     896+---------------+--------+-----------------------------------------------------+
     897| ``&&``        | Binary | Logical AND.                                        |
     898+---------------+--------+-----------------------------------------------------+
     899| ``||``        | Binary | Logical OR.                                         |
     900+---------------+--------+-----------------------------------------------------+
    832901
    833902
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette