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

kmk-qr: kmk-expressions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.