Pop-Up Thingie
Sidebar
>>> Magnum BBS <<<
Home
Forum
Files
Dark
Log in
Username
Password
Sidebar
Forum
Usenet
COMP.LANG.LISP
SBCL and OS interface
From
steve
@21:1/5 to
All
on Sun Jul 11 20:37:06 2021
The following partial functions work with sbcl using the SB-POSIX
interface. I still cannot understand how the ffi works; thank you SBCL people...
(defun tty-open-device (tty &key (debugging-p t))
(tty-close)
(let ((stdscr (or *current-screen* (setq *current-screen* (make-screen)))))
(setq tty (namestring tty))
(let* ((ofd (sb-posix:open tty sb-posix:o-wronly (logior sb-posix:o-noctty sb-posix:o-nonblock)))
(ifd (sb-posix:open tty sb-posix:o-rdonly (logior sb-posix:o-noctty sb-posix:o-nonblock)))
;; this needs to be fixed for input
(output (sb-sys:make-fd-stream ofd :buffering :none :output t :input nil :external-format :ascii))
(input (sb-sys:make-fd-stream ofd :buffering :none :output nil :input t :external-format :ascii))
)
[ ... ]
#|
;; Old Flags New Flags
;; ------------------------
;; I_flags; 25862 => 25606
;; O_flags; 5 => 5
;; C_flags; 1215 => 1215
;; L_flags; 35387 => 35377
|#
(defconstant ECHOCTL #o0001000)
(defun tty-set ()
(let ((termios (screen-termios-new (current-screen))))
;; set cannon mode/no echo
(setf (sb-posix:termios-lflag termios)
(logand (sb-posix:termios-lflag termios)
(lognot (logior sb-posix:icanon sb-posix:echo sb-posix:noflsh
ECHOCTL))))
;; set ignore nl/cr
(setf (sb-posix:termios-iflag termios)
(logand (sb-posix:termios-iflag termios) (lognot sb-posix:ICRNL)))
(setf (aref (sb-posix:termios-cc termios) sb-posix:vmin) 18)
(setf (aref (sb-posix:termios-cc termios) sb-posix:vtime) 1)
(sb-posix:tcsetattr (screen-ifd (current-screen)) sb-posix:tcsaflush termios)
(force-output (screen-output (current-screen)))
(current-screen)))
[ ... ]
I have been waiting for years to dump some of that c code! Thank you!!! again!!!
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)
Who's Online
Recent Visitors
Bob Worm
Thu Apr 25 22:17:10 2024
from
Wales, Uk
via
Telnet
Bob Worm
Fri Apr 26 10:09:36 2024
from
Wales, Uk
via
Telnet
Bob Worm
Fri Apr 26 08:24:20 2024
from
Wales, Uk
via
Telnet
Bob Worm
Fri Apr 26 06:40:30 2024
from
Wales, Uk
via
Telnet
System Info
Sysop:
Keyop
Location:
Huddersfield, West Yorkshire, UK
Users:
296
Nodes:
16 (
2
/
14
)
Uptime:
73:50:00
Calls:
6,657
Calls today:
3
Files:
12,203
Messages:
5,332,496
Posted today:
1