1 /* This file is part of the Project Athena Zephyr Notification System.
2 * It is one of the source files comprising zwgc, the Zephyr WindowGram
5 * Created by: Marc Horowitz <marc@athena.mit.edu>
7 * $Id: substitute.h 2133 2008-01-21 03:11:44Z kcr $
9 * Copyright (c) 1989 by the Massachusetts Institute of Technology.
10 * For copying and distribution information, see the file
15 #include <zephyr/mit-copyright.h>
17 #ifndef substitute_MODULE
18 #define substitute_MODULE
20 #include "new_string.h"
23 * string substitute(string (*lookup)(string); string text)
24 * Effects: returns the result of expanding all variable
25 * references in text using lookup. Example:
26 * "test $foo.$bar baz" would be translated to
27 * "text <foo>.<bar> baz" where "<foo>" is the value of
28 * lookup("foo") and "<bar>" is the value of lookup("bar").
29 * Variables are case sensitive and have the form
30 * {identifier_char}+ where identifier_char is defined
31 * in lexer.h by is_identifier_char. $(foo) and
32 * ${foo} are alternate forms for $foo. In particular,
33 * ${foo}bar is a reference to foo followed by "bar" while
34 * $foobar is a reference to foobar. Incomplete variable
35 * references like $(foo bar are displayed as if they
36 * were not variable references. To allow quoting, "$$"
37 * is translated to "$". Only the first
38 * MAX_IDENTIFIER_LENGTH characters of an identifier are
39 * significant. The strings returned by lookup are not
40 * modified in any way or freed.
43 extern string substitute(string (*)(string), string);