X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/disorder/blobdiff_plain/e7eb3a2744aa45179daea235800753d3d1955338..59cf25c47fbda22f3f4e14399f0436cc6ed2c56f:/lib/macros-builtin.c diff --git a/lib/macros-builtin.c b/lib/macros-builtin.c index ef98c8f..8c88f72 100644 --- a/lib/macros-builtin.c +++ b/lib/macros-builtin.c @@ -19,8 +19,16 @@ /** @file lib/macros-builtin.c * @brief Built-in expansions * - * This is a grab-bag of non-domain-specific expansions. Documentation will be - * generated from the comments at the head of each function. + * This is a grab-bag of non-domain-specific expansions + * + * Documentation is generated from the comments at the head of each function. + * The comment should have a '$' and the expansion name on the first line and + * should have a blank line between each paragraph. + * + * To make a bulleted list, put a '-' at the start of each line. + * + * You can currently get away with troff markup but this is horribly ugly and + * might be changed. */ #include "common.h" @@ -91,7 +99,7 @@ char *mx_find(const char *name, int report) { return path; } -/*! @include{TEMPLATE}@ +/*$ @include{TEMPLATE}@ * * Includes TEMPLATE. * @@ -146,7 +154,7 @@ static int exp_include(int attribute((unused)) nargs, return 0; } -/*! @include{COMMAND}@ +/*$ @include{COMMAND}@ * * Executes COMMAND via the shell (using "sh -c") and copies its * standard output to the template output. The shell command output @@ -195,7 +203,7 @@ static int exp_shell(int attribute((unused)) nargs, return 0; } -/*! @if{CONDITION}{IF-TRUE}{IF-FALSE}@ +/*$ @if{CONDITION}{IF-TRUE}{IF-FALSE}@ * * If CONDITION is "true" then evaluates to IF-TRUE. Otherwise * evaluates to IF-FALSE. The IF-FALSE part is optional. @@ -217,7 +225,7 @@ static int exp_if(int nargs, return 0; } -/*! @and{BRANCH}{BRANCH}...@ +/*$ @and{BRANCH}{BRANCH}...@ * * Expands to "true" if all the branches are "true" otherwise to "false". If * there are no brances then the result is "true". Only as many branches as @@ -243,7 +251,7 @@ static int exp_and(int nargs, return mx_bool_result(output, result); } -/*! @or{BRANCH}{BRANCH}...@ +/*$ @or{BRANCH}{BRANCH}...@ * * Expands to "true" if any of the branches are "true" otherwise to "false". * If there are no brances then the result is "false". Only as many branches @@ -269,7 +277,7 @@ static int exp_or(int nargs, return mx_bool_result(output, result); } -/*! @not{CONDITION}@ +/*$ @not{CONDITION}@ * * Expands to "true" unless CONDITION is "true" in which case "false". */ @@ -280,7 +288,7 @@ static int exp_not(int attribute((unused)) nargs, return mx_bool_result(output, !mx_str2bool(args[0])); } -/*! @#{...}@ +/*$ @#{...}@ * * Expands to nothing. The argument(s) are not fully evaluated, and no side * effects occur. @@ -292,7 +300,7 @@ static int exp_comment(int attribute((unused)) nargs, return 0; } -/*! @urlquote{STRING}@ +/*$ @urlquote{STRING}@ * * URL-quotes a string, i.e. replaces any characters not safe to use unquoted * in a URL with %-encoded form. @@ -307,7 +315,7 @@ static int exp_urlquote(int attribute((unused)) nargs, return 0; } -/*! @eq{S1}{S2}...@ +/*$ @eq{S1}{S2}...@ * * Expands to "true" if all the arguments are identical, otherwise to "false" * (i.e. if any pair of arguments differs). @@ -331,7 +339,7 @@ static int exp_eq(int nargs, return mx_bool_result(output, result); } -/*! @ne{S1}{S2}...@ +/*$ @ne{S1}{S2}...@ * * Expands to "true" if all of the arguments differ from one another, otherwise * to "false" (i.e. if any value appears more than once). @@ -355,7 +363,7 @@ static int exp_ne(int nargs, return mx_bool_result(output, result); } -/*! @discard{...}@ +/*$ @discard{...}@ * * Expands to nothing. Unlike the comment expansion @#{...}, side effects of * arguments are not suppressed. So this can be used to surround a collection @@ -368,7 +376,7 @@ static int exp_discard(int attribute((unused)) nargs, return 0; } -/*! @define{NAME}{ARG1 ARG2...}{DEFINITION}@ +/*$ @define{NAME}{ARG1 ARG2...}{DEFINITION}@ * * Define a macro. The macro will be called NAME and will act like an * expansion. When it is expanded, the expansion is replaced by DEFINITION, @@ -391,7 +399,7 @@ static int exp_define(int attribute((unused)) nargs, return 0; } -/*! @basename{PATH} +/*$ @basename{PATH} * * Expands to the UNQUOTED basename of PATH. */ @@ -402,7 +410,7 @@ static int exp_basename(int attribute((unused)) nargs, return sink_writes(output, d_basename(args[0])) < 0 ? -1 : 0; } -/*! @dirname{PATH} +/*$ @dirname{PATH} * * Expands to the UNQUOTED directory name of PATH. */ @@ -413,7 +421,7 @@ static int exp_dirname(int attribute((unused)) nargs, return sink_writes(output, d_dirname(args[0])) < 0 ? -1 : 0; } -/*! @q{STRING} +/*$ @q{STRING} * * Expands to STRING. */