Next: , Previous: , Up: Built-in functions   [Contents][Index]


7.2.3.30 $KEYWORD: Value of global RCS-like keyword

$KEYWORD’ provides a built-in function alternative to the use of ‘@K’ in a code part. (see ATK_).

$KEYWORD(Keyword)’ extracts (as a character string) the text of an RCS-like keyword defined in the ignorable commentary between ‘@z’ and ‘@x’ at the beginning of the web source file (see ATz). (RCS stands for “revision-control system.”) The general syntax is (UNIX users, see ‘man ident’)

$Keyword: text of keyword $

For example,

@z
$Author: krommes $
@x

@c
@
@a
char author[] = $KEYWORD(Author);

This tangles to

char author[] = "krommes";

In this example, ‘$Author’ is one of the standard RCS keywords. However, any keyword that fits the syntax ‘$keyword: contents $’ can be accessed by ‘$KEYWORD’. (At least one blank is necessary before and after contents.) The argument of ‘$KEYWORD’ need not be quoted, but it may be. In either event, the output is a quoted string.

Keywords extracted from ignorable commentary at the beginning of a web file are called global and are known throughout the code. Distinguish these from local keywords extracted from ignorable commentary at the beginning of an include (‘@i’) file. Such keywords are known only during the time that file is being read and are accessible via ‘@k’ (see ATk).

For convenience, built-ins are defined for some standard RCS global keywords. These are

$AUTHOR    => $KEYWORD(Author)
$DATE_TIME => $KEYWORD(Date)
$HEADER    => $KEYWORD(Header)
$ID        => $KEYWORD(Id)
$LOCKER    => $KEYWORD(Locker)
$NAME      => $KEYWORD(Name)
$RCSFILE   => $KEYWORD(RCSfile)
$REVISION  => $KEYWORD(Revision)
$SOURCE    => $KEYWORD(Source)
$STATE     => $KEYWORD(State)

There are no such abbreviations for local keywords, because such abbreviations would be expanded during output whereas it is necessary to recognize and expand the local keywords during input. Presumably such local keywords will be used rarely, if at all.


Next: , Previous: , Up: Built-in functions   [Contents][Index]