- Timestamp:
- Dec 30, 2008 4:45:46 PM (16 years ago)
- Location:
- trunk/kBuild/doc
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kBuild/doc/QuickReference-kmk.html
r2166 r2167 294 294 <h1 class="title">kmk Quick Reference</h1> 295 295 <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> 296 special targets, built-in commands, external commands, and <tt class="docutils literal"><span class="pre">kmk</span></tt>-expressions. 297 297 Since <em>all</em> the features are included, the quickness of this reference can be 298 298 disputed. ;-)</p> … … 877 877 $(intersects set-a, set-b) 878 878 </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> 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> 880 880 <pre class="literal-block"> 881 881 $(if-expr kmk-expression,true-part[,false-part]) 882 882 </pre> 883 <p>Select the first true condition (<tt class="docutils literal"><span class="pre">kmk</span></tt> 883 <p>Select the first true condition (<tt class="docutils literal"><span class="pre">kmk</span></tt>-expression) and expand the 884 884 following 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> 885 885 <pre class="literal-block"> 886 886 $(select when1-cond, when1-body[, whenN-cond, whenN-body]) 887 887 </pre> 888 <p>Evalutate the <tt class="docutils literal"><span class="pre">kmk </span></tt> expressionreturning what it evalues as. This is888 <p>Evalutate the <tt class="docutils literal"><span class="pre">kmk-expression</span></tt> returning what it evalues as. This is 889 889 the preferred way of doing arithmentic now:</p> 890 890 <pre class="literal-block"> … … 1222 1222 <div class="section"> 1223 1223 <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 1225 as <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 1226 the way GNU <tt class="docutils literal"><span class="pre">make</span></tt> choose to represent booleans in its function library, so, 1227 strings 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 1229 unquoted string results in soft strings that can be converted to number or 1230 boolean 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"><<</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">>></span></tt></td> 1299 <td>Bitwise right shift.</td> 1300 </tr> 1301 <tr><td><tt class="docutils literal"><span class="pre"><=</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"><</span></tt></td> 1306 <td>Less than.</td> 1307 </tr> 1308 <tr><td><tt class="docutils literal"><span class="pre">>=</span></tt></td> 1309 <td>Greater or equal than.</td> 1310 </tr> 1311 <tr><td><tt class="docutils literal"><span class="pre">></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">&</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">&&</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> 1225 1343 <hr class="docutils" /> 1226 1344 <table class="docutils field-list" frame="void" rules="none"> -
trunk/kBuild/doc/QuickReference-kmk.txt
r2166 r2167 4 4 5 5 This is an attempt at summarizing all directives, functions, special variables, 6 special targets, built-in commands, external commands, and ``kmk`` 6 special targets, built-in commands, external commands, and ``kmk``-expressions. 7 7 Since *all* the features are included, the quickness of this reference can be 8 8 disputed. ;-) … … 518 518 $(intersects set-a, set-b) 519 519 520 Same as ``$(if )`` execpt that the condition is a ``kmk`` 520 Same as ``$(if )`` execpt that the condition is a ``kmk``-expression:: 521 521 522 522 $(if-expr kmk-expression,true-part[,false-part]) 523 523 524 Select the first true condition (``kmk`` 524 Select the first true condition (``kmk``-expression) and expand the 525 525 following body. Special condition strings ``default`` and ``otherwise``:: 526 526 527 527 $(select when1-cond, when1-body[, whenN-cond, whenN-body]) 528 528 529 Evalutate the ``kmk `` expressionreturning what it evalues as. This is529 Evalutate the ``kmk-expression`` returning what it evalues as. This is 530 530 the preferred way of doing arithmentic now:: 531 531 … … 829 829 -------------- 830 830 831 todo 831 ``kmk``-expressions are related to the C/C++ preprocessor in some ways as well 832 as ``nmake`` and BSD ``make``. There are however some peculiarities because of 833 the way GNU ``make`` choose to represent booleans in its function library, so, 834 strings can be turned into boolean by taking any non-empty string as true. 835 836 Quoting using single quotes results in hard strings, while double quotes and 837 unquoted string results in soft strings that can be converted to number or 838 boolean to fit the situation. 839 840 Here'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 +---------------+--------+-----------------------------------------------------+ 832 901 833 902
Note:
See TracChangeset
for help on using the changeset viewer.