On Tue, 22 Sep 2015, Rainer Stratmann wrote:
What does SetRawMode do?
puts the terminal in RAW mode. This disables usual terminal tricks such as translating CTRL-C to SIGINT etc.
A terminal does quite some things 'behind your back', which are not desirable for the CRT unit. Michael.
var OldIO : termio.TermIos; inputRaw, outputRaw: boolean; procedure saveRawSettings(const tio: termio.termios); Begin with tio do begin inputRaw := ((c_iflag and (IGNBRK or BRKINT or PARMRK or ISTRIP or INLCR or IGNCR or ICRNL or IXON)) = 0) and ((c_lflag and (ECHO or ECHONL or ICANON or ISIG or IEXTEN)) = 0); outPutRaw := ((c_oflag and OPOST) = 0) and ((c_cflag and (CSIZE or PARENB)) = 0) and ((c_cflag and CS8) <> 0); end; end; procedure restoreRawSettings(tio: termio.termios); begin with tio do begin if inputRaw then begin c_iflag := c_iflag and (not (IGNBRK or BRKINT or PARMRK or ISTRIP or INLCR or IGNCR or ICRNL or IXON)); c_lflag := c_lflag and (not (ECHO or ECHONL or ICANON or ISIG or IEXTEN)); end; if outPutRaw then begin c_oflag := c_oflag and not(OPOST); c_cflag := c_cflag and not(CSIZE or PARENB) or CS8; end; end; end; Procedure SetRawMode(b:boolean); Var Tio : Termios; Begin if b then begin TCGetAttr(1,Tio); SaveRawSettings(Tio); OldIO:=Tio; CFMakeRaw(Tio); end else begin RestoreRawSettings(OldIO); Tio:=OldIO; end; TCSetAttr(1,TCSANOW,Tio); End; _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal