wrpp is a simple text processor; it copies text from a source file to a destination file processing embedded Wrapl code. Each piece of Wrapl code is escaped with a backslash \ and must contain exactly one expression or declaration. In practice this means that each piece of Wrapl code must end with a semicolon ;. To include a backslash in the output, follow it directly by a semicolon: \;.
All expressions and declarations are evaluated in the same global scope. For example:
would produce the following output:
A number of identifiers are predefined while wrpp processes Wrapl code.
Identifier | Description |
---|---|
stack | The output stream stack. This is a list of IO.Stream.T objects. |
push(buffer) | Pushes buffer onto stack. If buffer is omitted a new instance of IO.Buffer.T is used. |
pop() | Pops the last stream pushed onto stack and returns it. |
begin | A Std.Symbol.T useful for implementing begin/end environments. |
end | A Std.Symbol.T useful for implementing begin/end environments. |
buffer() | Returns a new IO.Buffer.T. |
include(filename) | Processes input from filename. |
_include_(filename) | Same as include(filename) but empty lines are not copied to the output. |
write(text) | Writes text to the current output stream (i.e. stack[1]). |
defines | A table which contains all -Did=value options passed on the command line. The contents of defines may be modified. |
includes | A list of directories to search for files in include(). May be modified. |
escape | The current character used to escape Wrapl code. May be modified, but should only ever be set to a single character. |
The basic invocation for wrpp is wrpp [options] <filename>. If
Option | Description |
---|---|
-D id=value | Adds the (key, value) pair (id, value) to defines. The =value may be omitted, in which case id is used value. |
-o filename | Writes the output to filename. If no -o option is present, output is written to stdout. |
-I directory | Adds directory to includes for searching for included files. |
-L directory | Adds directory to the module search path for riva. |
-p filename | Preincludes filename before reading the source file. Uses include to include the file. |
-P filename | Preincludes filename before reading the source file. Uses _include_ to include the file. |