Name: "macro_menu" Type: (Input) (Coroutine) Language: C Author: John Stephen (Tessella Support Services plc), 1993 Input: None Output: string - command, multi-line string - comment Parameters: Choice browser ENVIRONMENT VARIABLES AVS_MacroMenuPath - string AVS_MacroMenuFile - string Description: ------------ This module navigates a menu structure which can be designed and configured by the user. Each menu level is described by a single ASCII text file. A menu level contains several buttons with user-configurable names. Each button results in one of three basic kinds of action in the module: 1 load a new menu level 2 pass a command to downstream modules 3 go to a file to find a series of commands to be passed to down stream modules. Option 3 allows multiple commands to be played in background as the result of a single button press. The file containing the commands to be played in background is the second type of file associated with this system. Thus there are two types of file: (1) the MENU FILE to define a menu level (2) the AUTOMATIC FILE which contains a series of commands to be executed THE FORMAT OF THE MENU FILE: # begins a comment line, except: #TITLE=my title the menu title will be set to "my title" (Default is blank) #SEPAR=| the character "|" will be treated as a separator within lines. (Default is tab '\t') The use of the delimiter means that strings may contain blanks #NEWLINE=% the character "%" within the command field (ie the fourth field of a line) will be substituted with carriage return characters (ie '\n') in the output. (Default is #) my menu choice||||ignore||||comment||||command This is a line to define a single menu option. Each menu file will contain several of these lines. In this example "|" is used as a delimiter. Multiple adjacent delimiters are treated as a single delimiter which allows reasonable control over layout. The use of the delimiter means that strings may contain blanks The choice button on the menu will be set to "my menu choice". The field "ignore" must be present as an arbitrary string but it is ignored. The field comment may be any string and this affects what action is taken by the module. The comment string tells the module how to interpret the command string. The command string is may be any string; any occurences of the NEWLINE character are substituted by a carriage return ('\n'). The comment string may have any value, but two values have special meaning: MENU - in which case the module will go to a file named in the corresponding command string. This command string is concatenated with the value of AVS_MacroMenuPath. AUTOMATIC - in which case the module will read a series of commands from an automatic file named by the command string. As with the menu file's name the file will be found within AVS_MacroMenuPath. Any other comment string will be output on the "comment" output port, together with the corresponding command string which is output on the "command" port. It is up to downstream modules to interpret these strings. The two environment variables are: AVS_MacroMenuPath - directory containing the first menu file AVS_MacroMenuFile - the name of the first menu file THE FORMAT OF THE AUTOMATIC FILE: # begins a comment line, except: #SEPAR=| the character "|" will be treated as a separator within lines. (Default is tab '\t') The use of the delimiter means that strings may contain blanks #NEWLINE=% the character "%" within the command field (ie the fourth field of a line) will be substituted with carriage return characters (ie '\n') in the output. (Default is #) comment||||command This is a line to define a single menu option. Each menu file will contain several of these lines. In this example "|" is used as a delimiter. Multiple adjacent delimiters are treated as a single delimiter which allows reasonable control over layout. The use of the delimiter means that strings may contain blanks The choice button on the menu will be set to "my menu choice". The field "ignore" must be present as an arbitrary string but it is ignored. The field comment may be any string and this affects what action is taken by the module. The comment string tells the module how to interpret the command string. The command string is may be any string; any occurences of the NEWLINE character are substituted by a carriage return ('\n'). The comment string may have any value, but two values have special meaning: MENU - in which case the module will go to a file named in the corresponding command string. This command string is concatenated with the value of AVS_MacroMenuPath. Any subsequent line in the automatic file will be ignored. AUTOMATIC - in which case the module will read a series of commands from an automatic file named by the command string. As with the menu file's name the file will be found within AVS_MacroMenuPath. Any subsequent line in the automatic file will be ignored. Any other comment string will be output on the "comment" output port, together with the corresponding command string which is output on the "command" port. It is up to downstream modules to interpret these strings. # macro topic name and path file # for the string_macros module # # pathname of macro file Title string # ---------------------- ------------ /usr/avs/runtime/hosts This is macro 1 /tmp/xxx Here is another one /fred The last one is a little longer # macro topic name and path file # for the string_macros module # # pathname of macro file Title string # ---------------------- ------------ /usr/avs/runtime/hosts Ciao /tmp/xxx Bon Dias /fred Exeunt omnes Name: "string_macros" Type: (Input) (Subroutine) Language: C Author: Ian_Curington, Advanced Visual Systems, Inc. Output: string port, multi-line Parameters: Topic file browser ( configures the macro menu ) (string) Macro Choice browser list (for selecting a macro) (string) Description: ------------ This module provides a string macro facility for annotated choice lists anywhere strings are used in an AVS network. The module reads a configuration macro list file, sets up a choice list of macros, then puts the contents of the macro file at the output port. Module-----------> Topic File ---------->Macro File 1 |------------->Macro File 2 |------------->Macro File 3 .....etc... The file format of the Topic File is clear ASCII text, blank lines or "#" comment lines are ignored, each line has a filename with path, followed by words describing the macro. An example is shown below: # pathname of macro file Title string # ---------------------- ------------ /usr/avs/runtime/avsrc This is macro 1 /tmp/xxx Here is another one /fred/ginger The last one is a little longer The contents of the macro file itself shoule be clear text, can be one line or many lines, and is not interpreted.