Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ (1) — Inferno 4th Edition

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

sh(1)

sh-std(1)

sexprs(2)

SH-SEXPRS(1)

NAME

sexprs, islist, els, text, textels, mktext, mklist, mktextlist − parse and generate S-expressions

SYNOPSIS

load sexprs
 
getsexprs command
islist sexpr
${els sexpr}
${text sexpr}
${textels sexpr}
${mktext val}
${mklist [ val...
${mktextlist [ val...

DESCRIPTION

Sexprs is a loadable module for sh(1) that provides the facility to parse and generate S-expressions (see sexprs(2)). The following primitives are provided:

getsexprs Getsexprs works similiarly to getlines in sh-std(1). It reads S-expressions from the standard input, and for expression read, it invokes command with $sexp set to the text representation of that expression.  Getsexprs recognises the usual loop break and continue exceptions. 

islist sexp Islist yields a nil (true) status if sexp, which must be a well-formed S-expression, is a list element.

${els sexp}
If sexp is an S-expression containing a list, then els returns a list of the S-expressions it contains.  It is an error if sexp is not a valid S-expression. 

${text sexp}
If sexp is an S-expression containing a simple element, then text returns the value of that element. If sexp is a list, the return value will be an empty string.  Note that elements containing binary data will likely be corrupted by conversion to utf-8.  It is an error if sexp is not a valid S-expression. 

${textels sexp}
If sexp is an S-expression containing a list, then textels returns a list of the text values in that S-expression, converted as with ${text}.  It is an error if sexp is not a valid S-expression. 

${mktext val}
Mktext returns a text representation of the S-expression containing the simple value val.

${mklist [sexp...]}
Mklist returns a text representation of the S-expression list containing its arguments, which must be well-format S-expressions. 

${mktextlist [val...]}
Mktextlist returns a text representation of the S-expression list containing one simple element for each val.

SOURCE

/appl/cmd/sh/sexprs.b

SEE ALSO

sh(1), sh-std(1), sexprs(2)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026