Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.lisp > #61324

Re: :sbcl-posix and termios

From steve g <Sgonedes1977@gmail.com>
Newsgroups comp.lang.lisp
Subject Re: :sbcl-posix and termios
References <87ecga94bw.fsf@gmail.com> <n_idS.72904$DOD1.58901@fx17.ams4>
Date 2026-08-07 11:02 -0400
Message-ID <87se4qm0rv.fsf@gmail.com> (permalink)

Show all headers | View raw


Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.invalid> writes:

> On 07/08/2026 8:12 AM, steve g wrote:
>> I have been going crazy over this (over the years...)
>> I remeber that the Linux OS would put a pad of 0 bytes into the terminfo
>> struct. Really mean :)
>> I've enclosed a postscript because I like the colors better.
>>
> [snip transcript]
>
>>   any help would be useful. sorry for the postscript my email does not like me today.
>
> I'm sorry, I'm not really in a position to help right now.  Can you
> clarify what is wrong?

This is probably a good idea...

> Are you demonstrating a regression in the Posix or Termios interfaces
> in S.B.C.L? Or is it something you expected to work, but didn't?

No unfortunately I expected it to not run; however it seemed to work
quite fine for some years.

> I'm running S.B.C.L. on Windows now, and did not attempt any of the
> things in your transcript.

No terminfo is more of a unix thing. Terminfo is like conio.h in DOS
(dunno what windows does anymore). Terminfo is known to drive people
crazy. You should not use numbers - you should use weird macros.


just some "simple" termios:

[ ... ]

(setf (sb-posix::termios-iflag termios)
             (logior (sb-posix:termios-iflag termios)
                     (logior sb-posix:ISIG sb-posix:ICANON
             sb-posix:IEXTEN)))

(case <xyz>
  ((:NLCR :NL-to-CR)
       (terminfo::debugging-motion-macros "Disabling Carriage Return to New line Mode.")
       ;; if ignore CR is set, unset it
       (when (logand (sb-posix::termios-iflag termios) sb-posix:INLCR)
         ;; turn off ignore cr when set
         (setf (sb-posix:termios-iflag termios)
               (logior (sb-posix:termios-iflag termios) sb-posix:IGNCR)))
       (setf (sb-posix::termios-iflag termios)
             (logand (sb-posix:termios-iflag termios) (lognot sb-posix:IGNCR)))
       (setf (sb-posix:termios-oflag termios)
             (logand (sb-posix:termios-oflag termios) (lognot sb-posix:IGNCR))))



Does not work. I can't even read this anymore I am so sick of this. It
would be much easier to just put this stuff in a C shared library. The
convience of keeping this in lisp is/has been my goal.


;;; Inspection results.

TINFO> (current-tidevice)
#S(TIDEVICE
   :NAME "New Device"
   :STREAM-OUTPUT #<SB-SYS:FD-STREAM for "Device Output" {120C838393}>
   :STREAM-INPUT #<SB-SYS:FD-STREAM for "Device Input" {120C838543}>
   :OFD 8
   :IFD 9
   :ROWS 31
   :COLS 193
   :BAUD-RATE-INPUT 9600
   :BAUD-RATE-OUTPUT 9600
   :UPC 1042
   :OBUFSIZE 1066
   :TERMIOS-OLD #<SB-POSIX:TERMIOS {12127FEC53}>
   :TERMIOS-NEW #<SB-POSIX:TERMIOS {12127FEC63}>
   :CLOSED NIL)

TINFO> (inspect (current-tidevice))

The object is a STRUCTURE-OBJECT of type TIDEVICE.
0. NAME: New Device
1. STREAM-OUTPUT: #<FD-STREAM for "Device Output" {1200DA7AA3}>
2. STREAM-INPUT: #<FD-STREAM for "Device Input" {1200DA7BE3}>
3. OFD: 8
4. IFD: 9
5. ROWS: 31
6. COLS: 193
7. BAUD-RATE-INPUT: 9600
8. BAUD-RATE-OUTPUT: 9600
9. UPC: 1042
10. OBUFSIZE: 1066
11. TERMIOS-OLD: #<TERMIOS {1200DA7D23}>
12. TERMIOS-NEW: #<TERMIOS {1200DA7D33}>
13. CLOSED: NIL
> 11

The object is a STANDARD-OBJECT of type SB-POSIX:TERMIOS.
0. IFLAG: 17408
1. OFLAG: 5
2. CFLAG: 983231
3. LFLAG: 35377
4. CC: #(3 28 127 21 4 0 1 0 17 19 26 0 18 0 23 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)
5. REMAINING-FIELDS: #(0 0 0 0 0 150 0 0 0 150 0 0)
> q


The inspector shows the Iflag correctly, but I cannot access it. dunno,
I might just be too tired.

I thank you for your encouragement and support.

Back to comp.lang.lisp | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

:sbcl-posix and termios steve g <Sgonedes1977@gmail.com> - 2026-08-06 20:12 -0400
  Re: :sbcl-posix and termios Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.invalid> - 2026-08-07 19:05 +0800
    Re: :sbcl-posix and termios steve g <Sgonedes1977@gmail.com> - 2026-08-07 11:02 -0400
      Re: :sbcl-posix and termios Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.invalid> - 2026-08-08 01:32 +0800
        Re: :sbcl-posix and termios steve g <Sgonedes1977@gmail.com> - 2026-08-08 01:32 -0400
      Re: :sbcl-posix and termios Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.invalid> - 2026-08-08 21:36 +0800
        Re: :sbcl-posix and termios steve g <Sgonedes1977@gmail.com> - 2026-08-09 17:53 -0400

csiph-web