Changes between Version 1 and Version 2 of kmk Quick Reference


Ignore:
Timestamp:
Dec 30, 2008, 2:22:04 AM (16 years ago)
Author:
bird
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • kmk Quick Reference

    v1 v2  
    342342        $(printf fmt, arg...)
    343343
     344    Return the length of a string or a (unexpanded) variable::
     345
     346        $(length string)
     347        $(length-var var)
     348
     349    Find the position of ``needle`` in ``haystack``, returns 0 if not found.
     350    Negative ``start`` indices are relative to the end of ``haystack``, while
     351    positive ones are one based::
     352
     353        $(pos needle, haystack[, start])
     354        $(lastpos needle, haystack[, start])
     355
     356    Returns the specified substring. The ``start`` works like with ``$(pos )``.
     357    If the substring is partially outside the ``string`` the result will be
     358    padded with ``pad`` if present::
     359
     360        $(substr string, start[, length[, pad]])
     361
     362    Insert ``in`` into ``str`` at the specified position. ``n`` works like with
     363    ``$(pos )``, except that ``0`` is the end of the string::
     364
     365        $(insert in, str[, n[, length[, pad]]])
     366
     367    Translate ``string`` exchanging characters in ``from-set`` with ``to-set``,
     368    optionally completing ``to-set`` with ``pad-char`` if specified. If no
     369    ``pad-char`` characters absent in ``to-set`` will be deleted::
     370
     371        $(translate string, from-set[, to-set[, pad-char]])
     372
    344373
    345374Functions for file names:
     
    455484
    456485
    457 (Mostly) Boolean Functions:
     486Boolean and Conditional Functions:
    458487
    459488    Condition is false if the ``condition`` evaluates to an empty string
     
    494523    Same as ``$(if )`` execpt that the condition is a ``kmk`` expression::
    495524
    496         $(if kmk-expression,true-part[,false-part])
     525        $(if-expr kmk-expression,true-part[,false-part])
     526
     527    Select the first true condition (``kmk`` expression) and expand the
     528    following body. Special condition strings ``default`` and ``otherwise``::
     529
     530        $(select when1-cond, when1-body[, whenN-cond, whenN-body])
    497531
    498532    Evalutate the ``kmk`` expression returning what it evalues as. This is
     
    528562        $(value var)
    529563
    530     Evaluate ``text`` with ``var`` bound to each word in ``words``, and
     564    Evaluate ``body`` with ``var`` bound to each word in ``words``, and
    531565    concatenate the results (spaced)::
    532566
    533         $(foreach var,words,text)
     567        $(foreach var,words,body)
     568
     569    C-style for-loop. Start by evaluating ``init``. Each iteration will
     570    first check whether the ``condition`` (``kmk``-expression) is true,
     571    then expand ``body`` concatenating the result to the previous iterations
     572    (spaced), and finally evaluate ``next``::
     573
     574        $(for init,conditions,next,body)
     575
     576    C-style while-loop. Each iteration will check whether the ``condition``
     577    (``kmk``-expression) is true, then expand ``body`` concatenating the
     578    result to the previous iterations::
     579
     580        $(while conditions,body)
    534581
    535582    Evaluate the variable ``var`` replacing any references to ``$(1)``,
     
    704751
    705752
    706 Special targets
     753Special Targets
    707754---------------
    708755
     
    710757
    711758
     759
     760Built-in Commands
     761-----------------
     762
     763todo
     764
     765
     766
     767kmk-expression
     768--------------
     769
     770todo
     771
     772
     773
    712774-----
    713775
    714 :Status: $Id: QuickReference-kmk.txt 2146 2008-12-27 20:22:53Z bird $
     776:Status: $Id: QuickReference-kmk.txt 2163 2008-12-30 00:57:13Z bird $
    715777:Copyright: Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
    716778            1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005, 2006,