Ned the dolphin


what does expander do?

In its essence, expander is very simple, it reads input from stdin, and writes the output to stdout. In other words, expander is a filter. The input is a line containing an abbreviation or keyword, which is replaced with a predefined expansion string, with the result printed to stdout. These expansion strings are defined in text files and can be changed dynamically, meaning that any change to them is effective immediately, without having to reinitialize anything. The only exception is that expander has four built in abbreviations: 'date', 'time', 'dtime', and 'year'.

Diagram 1: expander workflow

Diagram 1. This schematic depicts how expander performs its duties using its definition dictionaries, templates, and auto-fill field features.

The following steps refer to the numbered areas in diagram 1.

1, 2
The expander utility is invoked as follows "expander C_code". The intent here is to tell expander that it should be using its C_code definitions when looking up abbreviations.
3
The abbreviation "header" is entered as expander reads its standard input stream. A return character entered after the "r" character gets expander to continue with its processing.
4, 5
Expander has to find its global definitions directory using the environment variable EXP_DEFINITION. From there it can locate its C_code definitions.
6, 7
Expander locates the "header" definition in the C_code definition set and discovers that the expansion involves a template file stored in the directory defined by the environment variable EXPANDER_TPL.
8, 9
The template file is read line for line to examine its contents for fields that can be automatically filled in because expander can discover their definitions too. In the sample template, expander will automatically fill in the date field, and use the defined "author" abbreviation to fill in that field.
10
The final text appears on expander's standard output stream. Note that the date and author field now have new values in place. (If the definitions were not available the fields would remain intact as they were found in the original template.)

In general, expander only knows where one definition dictionary file exists. It is accessed through examining the environment variable EXP_DEFINITIONS. This dictionary is the main source of, (computer) language independent definitions. From there all other dictionary files can be accessed, whether they be language independent, or language specific. This is basically done with an inclusion mechanism. Any dictionary can include other dictionaries. Thus, this initial dictionary is considered to be the root dictionary for a tree hierarchy of dictionaries. Since its definitions are always available, regardless of language scoping, it is also considered a 'global' dictionary.

Search

[an error occurred while processing this directive]
Sponsors

hosting and design by
Loco


unless otherwise stated all material is © 1999-2004 NEdit.org