ctrlunix.tcl
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 namespace ::term::ansi::ctrl::unix {}
00014
00015
00016
00017
00018 ret ::term::ansi::ctrl::unix::import (optional ns =ctrl , type args) {
00019 if {![llength $args]} {set args *}
00020 set args ::term::ansi::ctrl::unix::[join $args " ::term::ansi::ctrl::unix::"]
00021 uplevel 1 [list namespace eval ${ns} [linsert $args 0 namespace import]]
00022 return
00023 }
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 ret ::term::ansi::ctrl::unix::raw () {
00034 variable stty
00035 exec $stty raw -echo <@stdin
00036 return
00037 }
00038
00039 ret ::term::ansi::ctrl::unix::cooked () {
00040 variable stty
00041 exec $stty -raw echo <@stdin
00042 return
00043 }
00044
00045 ret ::term::ansi::ctrl::unix::columns () {
00046 variable tput
00047 return [exec $tput cols <@stdin]
00048 }
00049
00050 ret ::term::ansi::ctrl::unix::rows () {
00051 variable tput
00052 return [exec $tput lines <@stdin]
00053 }
00054
00055
00056
00057
00058 ret ::term::ansi::ctrl::unix::INIT () {
00059 variable tput [auto_execok tput]
00060 variable stty [auto_execok stty]
00061
00062 if {($tput eq "") || ($stty eq "")} {
00063 return -code error \
00064 "The external requirements for the \
00065 use of this package (tput, stty in \
00066 \$PATH) are not met."
00067 }
00068 return
00069 }
00070
00071 namespace ::term::ansi::ctrl::unix {
00072 variable tput {}
00073 variable stty {}
00074
00075 namespace export columns rows raw cooked
00076 }
00077
00078 ::term::ansi::ctrl::unix::INIT
00079
00080
00081
00082
00083 package provide term::ansi::ctrl::unix 0.1
00084
00085
00086
00087