next node: Stream,
prev node: Subsystem Streams,
up to node: Subsystem Streams


LineFormat

This structure provides functions for nicely formatted ASCII oriented lines.

Signature of LineFormat

List of Import References :
See BOOL
See Char
See DENOTATION
See Nat

SIGNATURE LineFormat

$Date: 2010-09-30 18:24:17 +0200 (Do, 30. Sep 2010) $ ($Revision: 616 $)

IMPORT Nat ONLY nat
       Char ONLY char

Current Line Length

Length of a line. This is initialized once at the start of the program. If the environment variable COLUMNS is set, # is that value, otherwise 80 is taken as the default.

FUN # : nat

Separator Lines

All the following functions come in two versions. The higher-order argument is the line length, which is # if not explicitly given.

Repeat argument, until desired length is reached. Result has exactly the given length.

FUN repeat: denotation -> denotation
FUN repeat: nat -> denotation -> denotation

Specialized with argument "-"

FUN -- : denotation
FUN -- : nat -> denotation

Centering

Center argument within line with spaces.

FUN center: denotation -> denotation
FUN center: nat -> denotation -> denotation

Center argument within line with first argument.

FUN center: char ** denotation -> denotation
FUN center: nat -> char ** denotation -> denotation

FUN center: denotation ** denotation -> denotation
FUN center: nat -> denotation ** denotation -> denotation

Surround

surround(left,right)(arg): Surround argument with left and right denotation. If result is longer than line length, the argument is shortened.

FUN surround: denotation ** denotation -> denotation -> denotation
FUN surround: nat -> denotation ** denotation -> denotation -> denotation

Boxes

box(ul,u,ur)(l,r)(dl,d,dr)(arg): put argument in a box. The higher-order arguments give the characters from which to use for the {up, down} {left, right} corners and the {left, right, upper, down} margins of the box. The variant without these parameters uses suitable defaults.

FUN box: char ** char ** char ->
         char ** char -> 
         char ** char ** char ->
         denotation -> denotation

FUN box: nat -> 
         char ** char ** char ->
         char ** char -> 
         char ** char ** char ->
         denotation -> denotation

FUN box: denotation -> denotation
FUN box: nat -> denotation -> denotation


next node: Stream,
prev node: Subsystem Streams,
up to node: Subsystem Streams