From d13d8a046838ce3d0e2643bb5b49f2ff77d679ca Mon Sep 17 00:00:00 2001 From: Marc Horowitz Date: Wed, 1 Nov 1989 20:02:01 +0000 Subject: Initial revision --- zwgc/substitute.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 zwgc/substitute.h (limited to 'zwgc/substitute.h') diff --git a/zwgc/substitute.h b/zwgc/substitute.h new file mode 100644 index 0000000..3558262 --- /dev/null +++ b/zwgc/substitute.h @@ -0,0 +1,29 @@ +#ifndef substitute_MODULE +#define substitute_MODULE + +#include "new_string.h" + +/* + * string substitute(string (*lookup)(string); string text) + * Effects: returns the result of expanding all variable + * references in text using lookup. Example: + * "test $foo.$bar baz" would be translated to + * "text . baz" where "" is the value of + * lookup("foo") and "" is the value of lookup("bar"). + * Variables are case sensitive and have the form + * {identifier_char}+ where identifier_char is defined + * in lexer.h by is_identifier_char. $(foo) and + * ${foo} are alternate forms for $foo. In particular, + * ${foo}bar is a reference to foo followed by "bar" while + * $foobar is a reference to foobar. Incomplete variable + * references like $(foo bar are displayed as if they + * were not variable references. To allow quoting, "$$" + * is translated to "$". Only the first + * MAX_IDENTIFIER_LENGTH characters of an identifier are + * significant. The strings returned by lookup are not + * modified in any way or freed. + */ + +extern string substitute(); + +#endif -- cgit v1.2.3