Re: VT100 Terminal library
From: Erik Buchmann (buchmann_at_iti.cs.uni-magdeburg.de)
Date: 10/14/03
- Next message: Bryan Oakley: "Re: Tcl weirdnesses"
- Previous message: lvirden_at_yahoo.com: "Re: Exec Hell - The Sequel"
- In reply to: Googie: "Re: VT100 Terminal library"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 14 Oct 2003 15:16:31 +0200
Hi Googie,
Googie wrote:
> Well, package can be downloaded from:
> ftp://scripts.one.pl/libterm-1.0.tar.gz
i've seen it, but it seems to be unnecessary complex.
The code below does roughly the same and adds full cursor control. I
wrote it some months ago as part of my library, but thought it wasnt
ready for publishing ;-)
CU, Erik
###########################################################################
# Constants for using with textAttr
set ::ansiTerm::AllOff 0
set ::ansiTerm::Bold 1
set ::ansiTerm::Underscore 4
set ::ansiTerm::Blink 5
set ::ansiTerm::Reverse 7
set ::ansiTerm::Concealed 8
set ::ansiTerm::BlackForeground 30
set ::ansiTerm::RedForeground 31
set ::ansiTerm::GreenForeground 32
set ::ansiTerm::YellowForeground 33
set ::ansiTerm::BlueForeground 34
set ::ansiTerm::MagentaForeground 35
set ::ansiTerm::CyanForeground 36
set ::ansiTerm::WhiteForeground 37
set ::ansiTerm::BlackBackground 40
set ::ansiTerm::RedBackground 41
set ::ansiTerm::GreenBackground 42
set ::ansiTerm::YellowBackground 43
set ::ansiTerm::BlueBackground 44
set ::ansiTerm::MagentaBackground 45
set ::ansiTerm::CyanBackground 46
set ::ansiTerm::WhiteBackground 47
###########################################################################
# ANSI Primitives
# Set the current text attribute. See constants or terminal
documentation for available values
proc ::ansiTerm::textAttr {m} {puts -nonewline [format
"\033\[%im" $m]}
# Clear terminal and reset all values to default.
proc ::ansiTerm::clearTerminal {} {puts -nonewline [format
"\033\[2J\033\[1;1H\033\[0m"]}
# Change Cursor position to absolute values
proc ::ansiTerm::cursorPosition {x y} {puts -nonewline [format
"\033\[%i;%iH" $y $x]}
# Move Cursor up by n lines
proc ::ansiTerm::cursorUp {l} {puts -nonewline [format
"\033\[%iA" $l]}
# Move Cursor down by n lines
proc ::ansiTerm::cursorDown {l} {puts -nonewline [format
"\033\[%iB" $l]}
# Move Cursor right by n columns
proc ::ansiTerm::cursorRight {l} {puts -nonewline [format
"\033\[%iC" $l]}
# Move Cursor left by n columns
proc ::ansiTerm::cursorLeft {l} {puts -nonewline [format
"\033\[%iD" $l]}
# Save current Cursor position
proc ::ansiTerm::cursorSave {} {puts -nonewline [format "\033\[s"]}
# Restore current Cursor position
proc ::ansiTerm::cursorRestore {} {puts -nonewline [format "\033\[u"]}
- Next message: Bryan Oakley: "Re: Tcl weirdnesses"
- Previous message: lvirden_at_yahoo.com: "Re: Exec Hell - The Sequel"
- In reply to: Googie: "Re: VT100 Terminal library"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|