Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
cmucl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Carl Shapiro
cmucl
Commits
31bbef79
Commit
31bbef79
authored
34 years ago
by
ram
Browse files
Options
Downloads
Patches
Plain Diff
Added GET-TERMINAL-ATTRIBUTES to get the terminal size and speed from unix.
parent
249af9aa
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
hemlock/tty-disp-rt.lisp
+32
-8
32 additions, 8 deletions
hemlock/tty-disp-rt.lisp
with
32 additions
and
8 deletions
hemlock/tty-disp-rt.lisp
+
32
−
8
View file @
31bbef79
...
...
@@ -7,7 +7,7 @@
;;; Scott Fahlman or slisp-group@cs.cmu.edu.
;;;
(
ext:file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/hemlock/tty-disp-rt.lisp,v 1.1.1.
2
1991/0
2/08
16:
38
:4
4
ram Exp $"
)
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/hemlock/tty-disp-rt.lisp,v 1.1.1.
3
1991/0
3/14
16:
25
:4
8
ram Exp $"
)
;;;
;;; **********************************************************************
;;;
...
...
@@ -46,7 +46,38 @@
(
setf
*hemlock-input-handler*
nil
))
(
standard-device-exit
))
;;;; Get terminal attributes:
(
defvar
*terminal-baud-rate*
nil
)
(
declaim
(
type
(
or
(
unsigned-byte
16
)
null
)
*terminal-baud-rate*
))
(
defalien
sgtty
mach:sgtty
(
record-size
'mach:sgtty
))
(
defalien
winsize
mach:winsize
(
record-size
'mach:winsize
))
;;; GET-TERMINAL-ATTRIBUTES -- Interface
;;;
;;; Get terminal attributes from Unix. Return as values, the lines,
;;; columns and speed. If any value is inaccessible, return NIL for that
;;; value. We also sleazily cache the speed in *terminal-baud-rate*, since I
;;; don't want to figure out how to get my hands on the TTY-DEVICE at the place
;;; where I need it. Currently, there really can only be one TTY anyway, since
;;; the buffer is in a global.
;;;
(
defun
get-terminal-attributes
(
&optional
(
fd
1
))
(
mach::with-trap-arg-block
mach:winsize
winsize
(
mach::with-trap-arg-block
mach:sgtty
sgtty
(
let
((
size-win
(
mach:unix-ioctl
fd
mach:TIOCGWINSZ
(
alien-sap
winsize
)))
(
speed-win
(
mach:unix-ioctl
fd
mach:TIOCGETP
(
alien-sap
sgtty
))))
(
values
(
and
size-win
(
alien-access
(
mach:winsize-ws_row
winsize
)))
(
and
size-win
(
alien-access
(
mach:winsize-ws_col
winsize
)))
(
and
speed-win
(
setq
*terminal-baud-rate*
(
svref
mach:terminal-speeds
(
alien-access
(
mach:sgtty-ospeed
sgtty
))))))))))
;;;; Output routines and buffering.
...
...
@@ -59,13 +90,6 @@
(
defvar
*redisplay-output-buffer-index*
0
)
(
proclaim
'
(
fixnum
*redisplay-output-buffer-index*
))
(
defvar
*terminal-baud-rate*
9600
"If true, this is an integer indicating the speed of the terminal. This used
to keep redisplay from getting ahead of the terminal, allowing redisplays in
progress to aborted when there is new command input."
)
(
proclaim
'
(
type
(
or
(
unsigned-byte
16
)
null
)
*terminal-baud-rate*
))
;;; WRITE-AND-MAYBE-WAIT -- Internal
;;;
;;; Write the first Count characters in the redisplay output buffer. If
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment