The Angst routines, written in Fortran, provide device-independent alphanumeric and graphics output to a variety of devices. They are part of my Gut library. They are used by my software for handling bibliographic references and by all of my graphics software based on my Dip library. Development started in 1983, with the help of Simon Freiwald. The overall philosophy is similar to that of termcap and ncurses in *n*x.
The basic approach is to get a command-sequence template for a given function from a device-definition file, fill in any required parameters (e.g., row and column numbers) and output the resulting string to the terminal using a null Fortran carriage-control character.
An environment variable,
FUN_TERM
, is used to specify which device is being used.
A second environment variable, FUN_LOC
, is used to specify the
location of the corresponding device-definition file(s).
The following lists identify the routines involved. The routines labelled ‘(VT100)’ are specific to the VT100 and don't use the device-independent mechanism described above.
anclr ;Alphanumeric-terminal clear screen (general) andec ;Alphanumeric-terminal DEC private escape sequences (VT100) anelf ;Alphanumeric-terminal erase line from cursor to EOL (general) aneras ;Alphanumeric-terminal erase (VT100) anexit ;Alphanumeric-terminal exit (general) anini1 anini2 aninit ;Alphanumeric-terminal initialize (general) anlnid ;Alphanumeric-terminal line insert/delete (VT100) anmova ;Alphanumeric-terminal cursor move, absolute (general) anmovr ;Alphanumeric-terminal cursor move, relative (VT100) annam ;Alphanumeric-terminal name get ansc ;Alphanumeric-terminal set colour ansgr ;Alphanumeric-terminal set graphic rendition (VT100) anstbm ;Alphanumeric-terminal set top & bottom margins (VT100)
gt1en1 ;(Graphics-terminal encode parameter for Envision, single) gt1en2 ;(Graphics-terminal encode parameter for Envision, double) gt1tk1 ;(Graphics-terminal encode parameter for Tektronix) gtan ;Graphics-terminal set alphanumeric mode gteras ;Graphics-terminal erase gtfeat ;Graphics-terminal get features gtfontsize ;Graphics-terminal get default font size gtgr ;Graphics-terminal set graphics mode gtinit ;Graphics-terminal initialize ;gtmask ;Graphics-terminal set mask gtncol ;Graphics-terminal get no. colours & shades gtnpix ;Graphics-terminal get no. pixels horizontally & vertically gtpl ;Graphics-terminal set plotting level on/off ;gtpol ;Graphics-terminal polygon/polyline draw gtsc ;Graphics-terminal set colour gtscm ;Graphics-terminal set colour map gttxo ;Graphics-terminal text output
angstp ;Alphanumeric/graphics-terminal put string with repeated nulls
chtyp ;Character type determination (numeric, alphanumeric or other) dc1 ;Decode: recognize a single character or an n-character string dcv ;Decode: recognize a character string out of a list of dcva ; variable-length strings, with/without ambiguity checking decodi ;Decode an integer number (decimal) decodo ;Decode an octal integer number encodi ;Encode an integer errid ;Error-identification subroutines file ;File-handling routines file_x ;File-handling routines (system-dependent) fnmak ;Make up a complete file name, using defaults getex ;Get extended token from a string getlun ;Get an available LUN getnb ;Get non-blank token from a string getok ;Get alphanumeric token from a string getrsf ;Get text record from sequential file gtermn ;Get terminal name (i.e. translate logical name TERM) ;locs ;Locate a substring in a string lowcv ;Convert to lower case (string) putrsf ;Put a record to a sequential file putsc ;Put a line of output with specified carriage control ;streq ;String equality check ;strmov ;String move ;strrp ;Replace substring (specified by pointer & length) by a string ;strrpi ;Replace given substring by an encoded integer ;strset ;String set to given character (repeated) trnlog ;Translate logical name upcas ;Convert to upper case (single character) upcv ;Convert to upper case (string)
The putsc
routine assumes that the output device has
been opened for Fortran carriage control, i.e.,
OPEN(..., CARRIAGECONTROL='FORTRAN', ...)
The file name to use in this OPEN
statement depends
on the operating system. For example, I use /dev/tty
under *n*x, and CONOUT$
under MS Windows.
The available device-definition files are listed below.
The device name specified in the FUN_TERM
environment variable is the root of the file name, e.g.,
vt100
or xlib
.
dummy.pen dvfgr_qw.gtd Digital Visual Fortran graphics (QuickWindows) dvfgr_qw.pen ega.gtd EGA graphics adapter ega.pen env230.gtd Envision 230 graphics terminal env230.pen fgraph.gtd Microsoft Fortran FGRAPH graphics under MS-DOS fgraph.pen go240.gtd GraphOn 240 graphics terminal go240.pen go250.gtd GraphOn 240 graphics terminal go250.pen grf.gtd Command-file output for Grf programme hir100.pen HiRes[?] terminal ibmem4010.pen EM4010 Tektronix-terminal emulator ibmem4105.gtd EM4105 Tektronix-terminal emulator ibmem4105.pen lj3.gtd LaserJet III pgf.gtd IBM Professional Graphics Adapter text file ppm.gtd PPM graphics file ps.gtd PostScript ps.pen tif.gtd TIFF graphics file vga.gtd VGA graphics adapter vga.pen vs2000.pen VAXstation 2000 vs3500.pen VAXstation 3500 vs3520.pen VAXstation 3520 vt100.pen VT100 terminal vt220.pen VT220 terminal vt240.pen VT240 terminal vt300.pen VT300 terminal vt640.gtd VT640 graphics add-on for VT100 terminal vt640.pen xlib.gtd X11 xlib.pen xlib.pen.1 xlib_big.gtd xlibs.gtd
The following is the .pen file for a VT100 terminal:
# VT100.PEN: BMEU keypad layout S. Freiwald 31-OCT-84 Set TTYPE 5 Set STYPE 2 Set WTYPE 1 Set OCINIT \e<\e=^O\e(B\e)0\e[?4l\e[?6l\e[?7l\e[r Set OCEXIT \e>\e[?7h Set OCHOME \e[H Set OCMOVEUP \e[A Set OCMOVEDOWN \e[B Set OCMOVERIGHT \e[C Set OCMOVELEFT \e[D Set OCXYPFX \e[ Set OCXYSEP ; Set OCXYSFX H Set OCCLSCREEN \e[H\e[2J^O\e(B\e)0\300 Set OCCLTOEOL \e[K\204 Set OCMARK ^N`^O Set OCGREYSP ^N~^O Set OCLM ^Nx^O Set OCLBM ^Nv^O Set OCBMON ^N Set OCBMOFF ^O Set OCBM q Set OCTSTOP v Set OCLSTOP n Set OCRSTOP n Set OCUNENTER \e[4m Set OCUNEXIT \e[0m WithYes SetKey \eOP SetMark WithYes SetKey \eOQ GetRegion WithYes SetKey \eOR PutRegion WithYes SetKey \eOS KillRegion WithYes SetKey \eOw BOL WithYes SetKey \eOx EOL WithYes SetKey \eOy Open WithYes SetKey \eOm Kill WithYes SetKey ^@ Argument WithYes SetKey \eOt Argument WithYes SetKey \eOu FileSelect WithYes SetKey \eOv SearchFwd WithYes SetKey \eOl FilterRegion WithYes SetKey \eOq ScrollUp WithYes SetKey \eOr ScrollDown WithYes SetKey \eOs BOF WithYes SetKey \eOp DelCharFwd WithYes SetKey \eOn ShapeRegion WithYes SetKey \eOM Exit WithYes SetKey ^X^C Abort WithYes SetKey ^X^J SaveFile WithYes SetKey ^Y^J ShapeRegion WithYes SetKey ^Z^J SearchBack WithYes SetKey ^\ Quote WithYes SetKey \e[A PrevLine WithYes SetKey \e[B NextLine WithYes SetKey \e[C CharFwd WithYes SetKey \e[D CharBack WithYes SetKey ^V^I IndentMode WithYes Set HelpKeyName 'Control-?' WithYes SetKey \r Return