TMGTERM.m

From VistApedia
Revision as of 22:24, 14 April 2005 by Kdtop3 (talk | contribs)
Jump to: navigation, search
;"--------------------------------------------------------------
;"Terminal interface 
;"ANSI Standard (X3.64) Control Sequences for Video Terminals and Peripherals
;"      in alphabetic order by mnemonic

EscN(Num,N2,Cmd)
       write $char(27,91)_Num
       if $data(N2) write ";"_N2
       if $data(Cmd) write Cmd
       quit

CBT(Pn) ;"CBT  Cursor Backward Tab  Esc [ Pn Z
       do EscN(.Pn,,"Z")
       quit

CCH     ;"Cancel Previous Character Esc T
       write $char(27)_"T"

CHA(Pn) ;"Cursor Horzntal Absolute  Esc [ Pn G
       do EscN(.Pn,,"G") quit

CHT(Pn) ;"Cursor Horizontal Tab     Esc [ Pn I
       do EscN(.Pn,,"I") quit

CNL(Pn) ;"Cursor Next Line          Esc [ Pn E
       do EscN(.Pn,,"E") quit

CPL(Pn) ;"Cursor Preceding Line     Esc [ Pn F
       do EscN(.Pn,,"F") quit

CPR(Pn,P2) ;"Cursor Position Report Esc [ Pn ; Pn R     VT100
       do EscN(.Pn,.P2,"R") quit

CTC(Pn) ;"Cursor Tab Control        Esc [ Ps W
       do EscN(.Pn,,"W") quit

CUB(Pn) ;"Cursor Backward           Esc [ Pn D          VT100
       do EscN(.Pn,,"D") quit

CUD(Pn) ;"Cursor Down               Esc [ Pn B          VT100
       do EscN(.Pn,,"B") quit

CUF(Pn) ;"Cursor Forward            Esc [ Pn C          VT100
       do EscN(.Pn,,"C") quit

CUP(X,Y) ;"Cursor Position        Esc [ Pn ; Pn H     VT100
       do EscN(.Y,.X,"H") quit
                                                                        
HOME    ;"Cursor Home               Esc [ H
       w $char(27,91)_"H" quit

CUU(Pn) ;"Cursor Up                 Esc [ Pn A          VT100
       do EscN(.Pn,,"A") quit

CVT(Pn) ;"Cursor Vertical Tab       Esc [ Pn Y
       do EscN(.Pn,,"Y") quit

DCH(Pn) ;"Delete Character          Esc [ Pn P
       do EscN(.Pn,,"P") quit

DL(Pn)  ;"Delete Line               Esc [ Pn M
       do EscN(.Pn,,"M") quit

EA(Pn)  ;"Erase in Area             Esc [ Ps O
       do EscN(.Pn,,"O") quit

ECH(Pn) ;"Erase Character           Esc [ Pn X
       do EscN(.Pn,,"X") quit

ED(Pn)  ;"Erase in Display          Esc [ Ps J         VT100
       do EscN(.Pn,,"J") quit

EF(Pn)  ;"Erase in Field            Esc [ Ps N
       do EscN(.Pn,,"N") quit

EL(Pn)  ;"Erase in Line             Esc [ Ps K         VT100
       do EscN(.Pn,,"K") quit

EPA     ;"End of Protected Area     Esc W
       w $char(27)_"W" quit

ESA     ;"End of Selected Area      Esc G
       w $char(27)_"G" quit

FNT(Pn,P2) ;"Font Selection            Esc [ Pn ; Pn Space D
       do EscN(.Pn,P2,"D") quit

GSM(Pn,P2) ;"Graphic Size Modify       Esc [ Pn ; Pn Space B
       do EscN(.Pn,P2,"B") quit

GSS(Pn) ;"Graphic Size Selection    Esc [ Pn Space C
       do EscN(.Pn,,"C") quit

HPA(Pn) ;"Horz Position Absolute    Esc [ Pn `
       do EscN(.Pn,,"`") quit

HPR(Pn) ;"Horz Position Relative    Esc [ Pn a
       do EscN(.Pn,,"a") quit

HTJ     ;"Horz Tab w/Justification  Esc I
       w $char(27)_"I" quit

HTS     ;"Horizontal Tab Set        Esc H             VT100
       w $char(27)_"H" quit

HVP(Pn,P2) ;"Horz & Vertical Position  Esc [ Pn ; Pn f  VT100
       do EscN(.Pn,P2,"A") quit

ICH(Pn) ;"Insert Character          Esc [ Pn @
       do EscN(.Pn,,"@") quit

IL(Pn)  ;"Insert Line               Esc [ Pn L
       do EscN(.Pn,,"L") quit

IND     ;"Index                     Esc D           VT100
       w $char(27)_"D" quit

NEL     ;"Next Line                 Esc E           VT100
       w $char(27)_"E" quit
                                                                                                                                                 
NP(Pn)  ;"Next Page                 Esc [ Pn U
       do EscN(.Pn,,"U") quit

PP(Pn)  ;"Preceding Page            Esc [ Pn V
       do EscN(.Pn,,"V") quit

IS      ;"Reset to Initial State    Esc c
       w $char(27)_"c" quit

RM(Pn)  ;"Reset Mode                Esc [ Ps l     VT100
       do EscN(.Pn,,"l") quit

SD(Pn)  ;"Scroll Down               Esc [ Pn T
       do EscN(.Pn,,"T") quit

SL(Pn)  ;"Scroll Left               Esc [ Pn Space @
       do EscN(.Pn,," @") quit

SM(Pn)  ;"Select Mode               Esc [ Ps h     VT100
       do EscN(.Pn,,"h") quit

SPA     ;"Start of Protected Area   Esc V
       w $char(27)_"V" quit
                                         
SPI(Pn,P2) ;"Spacing Increment         Esc [ Pn ; Pn Space G
       do EscN(.Pn,P2," G") quit

SR(Pn)  ;"Scroll Right              Esc [ Pn Space A
       do EscN(.Pn,," A") quit

SA      ;"Start of Selected Area    Esc F
       w $char(27)_"F" quit

ST      ;"String Terminator         Esc \
       w $char(27)_"\" quit

SU(Pn)  ;"Scroll Up                 Esc [ Pn S
       do EscN(.Pn,,"S") quit

TBC(Pn) ;"Tab Clear                 Esc [ Ps g        VT100
       do EscN(.Pn,,"g") quit

VPA(Pn) ;"Vert Position Absolute    Esc [ Pn d
       do EscN(.Pn,,"d") quit

VPR(Pn) ;"Vert Position Relative    Esc [ Pn e
       do EscN(.Pn,,"e") quit

                     
VCULOAD ;"Unsave Cursor                              ESC [ u
       w $char(27,91)_"u" quit

VCUSAV2 ;"Save Cursor & Attrs                        ESC 7
       w $char(27)_"7" quit

VCULOAD2 ;"Restore Cursor & Attrs                    ESC 8
       w $char(27)_"8" quit

VTATRIB(n) ;"Set Text attributes    <ESC>[{attr1};...;{attrn}m
       ;"0-Reset all attributes
       ;"1-Bright
       ;"2-Dim
       ;"4-Underscore
       ;"5-Blink
       ;"7-Reverse
       ;"8-Hidden
       do EscN(n,,"m") quit

VFGCOLOR(n) ;"Set Text Foreground Color  <ESC>[{attr1};...;{attrn}m
       set n=n+30
       do EscN(n,,"m") quit
                                                                             
;"--------------------------------------------------------------
;"VT100 specific calls
;"Terminal interface

VCEL    ;"Erase from cursor to end of line           Esc [ 0 K    or Esc [ K
       do EscN("0",,"K") quit

VCBL    ;"Erase from beginning of line to cursor     Esc [ 1 K
       do EscN("1",,"K") quit

VEL     ;"Erase line containing cursor               Esc [ 2 K
       do EscN("2",,"K") quit

VCES    ;"Erase from cursor to end of screen         Esc [ 0 J    or Esc [ J
       do EscN("0",,"J") quit

VCBS    ;"Erase from beginning of screen to cursor   Esc [ 1 J
       do EscN("1",,"J") quit

VCS     ;"Erase entire screen                        Esc [ 2 J
       do EscN("2",,"J") quit
                                                                        
VCUSAV  ;"Save Cursor                                ESC [ s
       w $char(27,91)_"s" quit

VCULOAD ;"Unsave Cursor                              ESC [ u
       w $char(27,91)_"u" quit

VCUSAV2 ;"Save Cursor & Attrs                        ESC 7
       w $char(27)_"7" quit

VCULOAD2 ;"Restore Cursor & Attrs                    ESC 8
       w $char(27)_"8" quit

VTATRIB(n) ;"Set Text attributes    <ESC>[{attr1};...;{attrn}m
       ;"0-Reset all attributes
       ;"1-Bright
       ;"2-Dim
       ;"4-Underscore
       ;"5-Blink
       ;"7-Reverse
       ;"8-Hidden
       do EscN(n,,"m") quit

VFGCOLOR(n) ;"Set Text Foreground Color  <ESC>[{attr1};...;{attrn}m
       set n=n+30
       do EscN(n,,"m") quit
                                                            
VBGCOLOR(n) ;"Set Text Background Color  <ESC>[{attr1};...;{attrn}m
       set n=n+40
       do EscN(n,,"m") quit

VCOLORS(FG,BG) ;Set Text Colors   <ESC>[{attr1};...;{attrn}m
       set FG=FG+30
       set BG=BG+40
       do EscN(FG,BG,"m") quit
       quit

SetGlobals
       set TMGcBlack=0
       set TMGcRed=1
       set TMGcGreen=2
       set TMGcYellow=3
       set TMGcBlue=4
       set TMGcMagenta=5
       set TMGcCyan=6
       set TMGcWhite=7

       quit
                                      
KillGlobals
       kill TMGcBlack
       kill TMGcRed
       kill TMGcGreen
       kill TMGcYellow
       kill TMGcBlue
       kill TMGcMagenta
       kill TMGcCyan
       kill TMGcWhite

       quit