Oberon || Library || Module Index || Search Engine || Definition || Module


Ulm's Oberon Library:
TermInfos


NAME

TermInfos - interface to the UNIX terminfo database

SYNOPSIS

CONST stringlen = 255;
CONST maxParameters = 9;
(* errorcodes *)
CONST notSupported = 0; badFormatString = 1; invalidParameterList = 2;
CONST stackUnderflow = 3; stackOverflow = 4; endOfStream = 5;
CONST invalidTerminfo = 6;
CONST errorcodes = 7;
(* booleans *)
CONST autoLeftMargin = 0; autoRightMargin = 1; noEscCtlc = 2;
CONST ceolStandoutGlitch = 3; eatNewlineGlitch = 4; eraseOverstrike = 5;
CONST genericType = 6; hardCopy = 7; hasMetaKey = 8; hasStatusLine = 9;
CONST insertNullGlitch = 10; memoryAbove = 11; memoryBelow = 12;
CONST moveInsertMode = 13; moveStandoutMode = 14; overStrike = 15;
CONST statusLineEscOk = 16; destTabsMagicSmso = 17; tildeGlitch = 18;
CONST transparentUnderline = 19; xonXoff = 20; needsXonXoff = 21;
CONST prtrSilent = 22; hardCursor = 23; nonRevRmcup = 24; noPadChar = 25;
CONST nonDestScrollRegion = 26;
(* numbers *)
CONST columns = 0; initTabs = 1; lines = 2; linesOfMemory = 3;
CONST magicCookieGlitch = 4; paddingBaudRate = 5; virtualTerminal = 6;
CONST widthStatusLine = 7; numLabels = 8; lablHeight = 9; lablWidth = 10;
CONST maxAttributes = 11; maximumWindows = 12;
(* strings *)
CONST backTab = 0; bell = 1; carriageReturn = 2; changeScrollRegion = 3;
CONST clearAllTabs = 4; clearScreen = 5; clrEol = 6; clrEos = 7;
CONST columnAddress = 8; commandChar = 9; cursorAddress = 10; cursorDown = 11; 
CONST cursorHome = 12; cursorInvisible = 13; cursorLeft = 14;
CONST cursorMemoryAddress = 15; cursorNormal = 16; cursorRight = 17;
CONST cursorToLine1 = 18; cursorUp = 19; cursorVisible = 20; deleteChar = 21;
CONST deleteLine = 22; disableStatusLine = 23; downHalfLine = 24;
CONST enterAltCharSet = 25; enterBlinkMode = 26; enterBoldMode = 27;
CONST enterCaMode = 28; enterDeleteMode = 29; enterDimMode = 30;
CONST enterInsertMode = 31; enterSecureMode = 32; enterProtectedMode = 33;
CONST enterReverseMode = 34; enterStandoutMode = 35; enterUnderlineMode = 36;
CONST eraseChars = 37; exitAltCharSet = 38; exitAttributeMode = 39;
CONST exitCaMode = 40; exitDeleteMode = 41; exitInsertMode = 42;
CONST exitStandoutMode = 43; exitUnderlineMode = 44; flashScreen = 45;
CONST formFeed = 46; fromStatusLine = 47; init1string = 48; init2string = 49;
CONST init3string = 50; initFile = 51; insertCharacter = 52; insertLine = 53;
CONST insertPadding = 54; keyBackspace = 55; keyCatab = 56; keyClear = 57;
CONST keyCtab = 58; keyDc = 59; keyDl = 60; keyDown = 61; keyEic = 62;
CONST keyEol = 63; keyEos = 64; keyF0 = 65; keyF1 = 66; keyF10 = 67;
CONST keyF2 = 68; keyF3 = 69; keyF4 = 70; keyF5 = 71; keyF6 = 72; keyF7 = 73;
CONST keyF8 = 74; keyF9 = 75; keyHome = 76; keyIc = 77; keyIl = 78;
CONST keyLeft = 79; keyLl = 80; keyNpage = 81; keyPpage = 82; keyRight = 83;
CONST keySf = 84; keySr = 85; keyStab = 86; keyUp = 87; keypadLocal = 88;
CONST keypadXmit = 89; labF0 = 90; labF1 = 91; labF10 = 92; labF2 = 93;
CONST labF3 = 94; labF4 = 95; labF5 = 96; labF6 = 97; labF7 = 98; labF8 = 99;
CONST labF9 = 100; metaOff = 101; metaOn = 102; newline = 103; padChar = 104;
CONST parmDch = 105; parmDeleteLine = 106; parmDownCursor = 107; parmIch = 108;
CONST parmIndex = 109; parmInsertLine = 110; parmLeftCursor = 111;
CONST parmRightCursor = 112; parmRindex = 113; parmUpCursor = 114;
CONST pkeyKey = 115; pkeyLocal = 116; pkeyXmit = 117; printScreen = 118;
CONST prtrOff = 119; prtrOn = 120; repeatChar = 121; reset1string = 122;
CONST reset2string = 123; reset3string = 124; resetFile = 125;
CONST restoreCursor = 126; rowAddress = 127; saveCursor = 128;
CONST scrollForward = 129; scrollReverse = 130; setAttributes = 131;
CONST setTab = 132; setWindow = 133; tab = 134; toStatusLine = 135;
CONST underlineChar = 136; upHalfLine = 137; initProg = 138; keyA1 = 139;
CONST keyA3 = 140; keyB2 = 141; keyC1 = 142; keyC3 = 143; prtrNon = 144;
CONST charPadding = 145; acsChars = 146; plabNorm = 147; keyBtab = 148;
CONST enterXonMode = 149; exitXonMode = 150; enterAmMode = 151;
CONST exitAmMode = 152; xonCharacter = 153; xoffCharacter = 154; enaAcs = 155;
CONST lablOn = 156; lablOff = 157; keyBeg = 158; keyCancel = 159;
CONST keyClose = 160; keyCommand = 161; keyCopy = 162; keyCreate = 163;
CONST keyEnd = 164; keyEnter = 165; keyExit = 166; keyFind = 167;
CONST keyHelp = 168; keyMark = 169; keyMessage = 170; keyMove = 171;
CONST keyNext = 172; keyOpen = 173; keyOptions = 174; keyPrevious = 175;
CONST keyPrint = 176; keyRedo = 177; keyReference = 178; keyRefresh = 179;
CONST keyReplace = 180; keyRestart = 181; keyResume = 182; keySave = 183;
CONST keySuspend = 184; keyUndo = 185; keySbeg = 186; keyScancel = 187;
CONST keyScommand = 188; keyScopy = 189; keyScreate = 190; keySdc = 191;
CONST keySdl = 192; keySelect = 193; keySend = 194; keySeol = 195;
CONST keySexit = 196; keySfind = 197; keyShelp = 198; keyShome = 199;
CONST keySic = 200; keySleft = 201; keySmessage = 202; keySmove = 203;
CONST keySnext = 204; keySoptions = 205; keySprevious = 206; keySprint = 207;
CONST keySredo = 208; keySreplace = 209; keySright = 210; keySrsume = 211;
CONST keySsave = 212; keySsuspend = 213; keySundo = 214; reqForInput = 215;
CONST keyF11 = 216; keyF12 = 217; keyF13 = 218; keyF14 = 219; keyF15 = 220;
CONST keyF16 = 221; keyF17 = 222; keyF18 = 223; keyF19 = 224; keyF20 = 225;
CONST keyF21 = 226; keyF22 = 227; keyF23 = 228; keyF24 = 229; keyF25 = 230;
CONST keyF26 = 231; keyF27 = 232; keyF28 = 233; keyF29 = 234; keyF30 = 235;
CONST keyF31 = 236; keyF32 = 237; keyF33 = 238; keyF34 = 239; keyF35 = 240;
CONST keyF36 = 241; keyF37 = 242; keyF38 = 243; keyF39 = 244; keyF40 = 245;
CONST keyF41 = 246; keyF42 = 247; keyF43 = 248; keyF44 = 249; keyF45 = 250;
CONST keyF46 = 251; keyF47 = 252; keyF48 = 253; keyF49 = 254; keyF50 = 255;
CONST keyF51 = 256; keyF52 = 257; keyF53 = 258; keyF54 = 259; keyF55 = 260;
CONST keyF56 = 261; keyF57 = 262; keyF58 = 263; keyF59 = 264; keyF60 = 265;
CONST keyF61 = 266; keyF62 = 267; keyF63 = 268; clrBol = 269;
CONST clearMargins = 270; setLeftMargin = 271; setRightMargin = 272;
CONST lablFormat = 273; setClock = 274; displayClock = 275; removeClock = 276;
CONST createWindow = 277; gotoWindow = 278; hangup = 279; dialPhone = 280;
CONST quickDial = 281; tone = 282; pulse = 283; flashHook = 284;
CONST fixedPause = 285; waitTone = 286; user0 = 287; user1 = 288; user2 = 289;
CONST user3 = 290; user4 = 291; user5 = 292; user6 = 293; user7 = 294;
CONST user8 = 295; user9 = 296;


TYPE String = ARRAY stringlen OF CHAR;

TYPE Parameter = POINTER TO ParameterRec; TYPE ParameterRec = RECORD END;

TYPE BoolPara = POINTER TO BoolParaRec; TYPE BoolParaRec = RECORD (ParameterRec) bool: BOOLEAN; END;

TYPE IntPara = POINTER TO IntParaRec; TYPE IntParaRec = RECORD (ParameterRec) int: INTEGER; END;

TYPE StringPara = POINTER TO StringParaRec; TYPE StringParaRec = RECORD (ParameterRec) string: String; END;

TYPE ParameterList = POINTER TO ParameterListRec; TYPE ParameterListRec = RECORD (Objects.ObjectRec) para: ARRAY maxParameters OF Parameter; END;

TYPE ErrorEvent = POINTER TO ErrorEventRec; TYPE ErrorEventRec = RECORD (Events.EventRec) errorcode: SHORTINT; END;

TYPE TermInfo = POINTER TO TermInfoRec; TYPE TermInfoRec = RECORD (Disciplines.ObjectRec) END;

TYPE Capability = INTEGER;

VAR error: Events.EventType; VAR errormsg: ARRAY errorcodes OF Events.Message;

PROCEDURE Open(termname: ARRAY OF CHAR; VAR terminfo: TermInfo; errors: RelatedEvents.Object): BOOLEAN; PROCEDURE GetBoolean(terminfo: TermInfo; cap: Capability): BOOLEAN; PROCEDURE GetNumber(terminfo: TermInfo; cap: Capability): INTEGER; PROCEDURE CapStringOk(terminfo: TermInfo; cap: Capability): BOOLEAN; PROCEDURE GetCapString(terminfo: TermInfo; cap: Capability; VAR string: String); PROCEDURE PutCapString(terminfo: TermInfo; cap: Capability; plist: ParameterList; speed: INTEGER; affcount: INTEGER; stream: Streams.Stream);

DESCRIPTION

TermInfos interfaces the UNIX terminfo database. The terminfo database describes the capabilities and properties of devices such as terminals and printers. Devices are described in terminfo source files by specifying a set of capabilities (booleans), by quantifying certain aspects of the device (numbers), and by specifying character sequences that effect particular results (strings). This module is mainly intended for use by UnixTerminals.

Open opens a terminfo source file and stores its contents into terminfo. termname is the name of a particular source file. The string specified by the environment variable TERM is used in case termname is an empty string. Open checks the environment variable TERMINFO for the name of the terminfo root directory. If not set it defaults to /usr/lib/terminfo.

GetBoolean and GetNumber return the corresponding value of cap.

CapStringOk returns TRUE if the capability string designated by cap is not empty (i.e. the capability string is supported), FALSE otherwise.

GetCapString returns the capability string designated by cap.

PutCapString formats the capability string designated by cap and writes it to stream. plist contains the parameters for the formatstring. speed represents the speed of the terminal. For operations which require proportional padding, affcount has to hold the number of objects affected. Otherwise it must be set to 1.

DIAGNOSTICS

All errors lead to events of type error which are passed to RelatedEvents for further handling. Following error codes are currently implemented:

notSupported
requested capability not supported by terminal.
badFormatString
bad format in capability string.
invalidParameterList
missing parameter in parameter list.
stackUnderflow
underflow of internal stack.
stackOverflow
overflow of internal stack.
endOfStream
end of stream reached.
invalidTerminfo
error in terminfo file or unsupported version.

SEE ALSO

RelatedEvents
error handling
Terminals
abstraction for terminals
terminfo(5)
terminal capability database
UnixTerminals
UNIX implementation of Terminals

BUGS

Static variables as described in terminfo(5) are not yet supported.

AUTHOR

Ralf Beck
minor revisions added by Andreas Borchert
Edited by: borchert, last change: 2005/02/09, revision: 1.7, converted to HTML: 2005/02/09

Oberon || Library || Module Index || Search Engine || Definition || Module