Database Syntax (Units: A Unit Conversion Program and Scientific Calculator)

## 22 Database Command Syntax ¶

`unit definition`

  Define a regular unit.

`prefix- definition`

  Define a prefix.

`funcname(var) noerror units=[in-units,out-units] domain=[x1,x2] range=[y1,y2] definition(var) ; inverse(funcname)`

  Define a nonlinear unit or unit function. The four optional keywords `noerror`, ‘`units=`’, ‘`range=`’ and ‘`domain=`’ can appear in any order. The definition of the inverse is optional.

`tabname[out-units] noerror pair-list`

  Define a piecewise linear unit. The pair list gives the points on the table listed in ascending order. The `noerror` keyword is optional.

`!endlocale`

  End a block of definitions beginning with ‘`!locale`’

`!endutf8`

  End a block of definitions begun with ‘`!utf8`’

`!endvar`

  End a block of definitions begun with ‘`!var`’ or ‘`!varnot`’

`!include file`

  Include the specified file.

`!locale value`

  Load the following definitions only of the locale is set to value.

`!message text`

  Display text when the database is read unless the quiet option (`-q`) is enabled. If you omit text, then units will display a blank line. Messages will also appear in the log file.

`!prompt text`

  Prefix the ‘`You have:`’ prompt with the specified text. If you omit text, then any existing prefix is canceled.

`!set variable value`

  Sets the environment variable, variable, to the specified value only if it is not already set.

`!unitlist alias definition`

  Define a unit list alias.

`!utf8`

  Load the following definitions only if `units` is running with UTF-8 enabled.

`!var envar value-list`

  Load the block of definitions that follows only if the environment variable envar is set to one of the values listed in the space-separated value list. If envar is not set, `units` prints an error message and ignores the block of definitions.

`!varnot envar value-list`

  Load the block of definitions that follows only if the environment variable envar is set to value that is not listed in the space-separated value list. If envar is not set, `units` prints an error message and ignores the block of definitions.