Table of Contents

Name

pl_fread, pl_lread, pl_exec - ASCII interpreter of YAPP commands

Synopsis


#include <layout.h>
plcommand *pl_fread(string filename)
int pl_lread(string line, plcommand *p)
void pl_exec(plcommand *p)
void pl_readlines(void);

Description

The layout(3NEMO) routines proved the programmer with an ASCII interpreter and executionar of all basic yapp(3NEMO) routines (see layout(5NEMO) for a listing). They are mostly used to add a standard ‘‘background’’ to a dynamic picture, yet which needs to be programmable by the outside user.

With the routine pl_fread a layout(5NEMO) (regular text) file is read, it’s YAPP commands are interpreted and placed in a linked list of plcommand’s, returned as a pointer to that structure. Commands that are not understood are skipped and not saved.

The routine pl_lread reads a single line, parses it in YAPP commands, and stores the encoded command in the plcommand structure pointed to by p. Of course pl_fread calls pl_lread to do its work. pl_lread returns the number of arguments (including the YAPP command); 0 means no legal command (or a blank line) was encountered and the structures contents have no meaning.

The routine pl_exec executes a previously read LAYOUT file, by passing it a pointer to the linked list of plcommand. The linked list is traversed until it ends or the End command is encountered.

The routine pl_readlines keeps reading commands from stdin (via the READLINE library if present) and executing them, in effect giving a simple mongo/sm/wip type interface.

Examples

The following code reads a layout file entered through a program keyword layout=, parses it and executes it. Because of the nested programming style, the linked list of plcommand is lost.
    pl_exec(pl_fread(getparam("layout")));

See Also

tabplot(1NEMO) , yapp(3NEMO) , layout(5NEMO)

Author

Peter Teuben

Update History


20-oct-92     written              PJT
17-sep-05    added pl_readlines    PJT


Table of Contents