2
$Id: termiosproc.inc,v 1.2 2004/02/05 14:00:45 jonas Exp $
3
This file is part of the Free Pascal run time library.
4
Copyright (c) 1999-2000 by Peter Vreman
5
member of the Free Pascal development team.
7
See the file COPYING.FPC, included in this distribution,
8
for details about the copyright.
10
This file contains the implementation of several termio(s) functions
12
This program is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16
**********************************************************************}
18
{******************************************************************************
19
IOCtl and Termios calls
20
******************************************************************************}
22
Function TCGetAttr(fd:cint;var tios:TermIOS):cint;
24
TCGETAttr:=fpIoCtl(Fd,TIOCGETA,@tios);
27
Function TCSetAttr(fd:cint;OptAct:cint;const tios:TermIOS):cint;
32
TCSANOW : nr:=TIOCSETA;
33
TCSADRAIN : nr:=TIOCSETAW;
34
TCSAFLUSH : nr:=TIOCSETAF;
37
fpsetErrNo(ESysEINVAL);
42
TCSetAttr:=fpIOCtl(fd,nr,@Tios);
45
Procedure CFSetISpeed(var tios:TermIOS;speed:Cardinal);
47
tios.c_ispeed:=speed; {Probably the Bxxxx speed constants}
51
Procedure CFSetOSpeed(var tios:TermIOS;speed:Cardinal);
58
Procedure CFMakeRaw(var tios:TermIOS);
62
c_iflag:=c_iflag and (not (IMAXBEL or IXOFF or INPCK or BRKINT or
63
PARMRK or ISTRIP or INLCR or IGNCR or ICRNL or IXON or
65
c_iflag:=c_iflag OR IGNBRK;
66
c_oflag:=c_oflag and (not OPOST);
67
c_lflag:=c_lflag and (not (ECHO or ECHOE or ECHOK or ECHONL or ICANON or
68
ISIG or IEXTEN or NOFLSH or TOSTOP or PENDIN));
69
c_cflag:=(c_cflag and (not (CSIZE or PARENB))) or (CS8 OR cread);
75
//Function TCGetAttr(fd:cint;var tios:TermIOS):cint; cdecl; external 'c' name 'tcgetattr';
76
//Function TCSetAttr(fd:cint;OptAct:cint;const tios:TermIOS):cint; cdecl; external 'c' name 'tcsetattr';
77
//Procedure CFSetISpeed(var tios:TermIOS;speed:Cardinal); cdecl; external 'c' name 'cfsetispeed';
78
//Procedure CFSetOSpeed(var tios:TermIOS;speed:Cardinal); cdecl; external 'c' name 'cfsetospeed';
79
//Procedure CFMakeRaw(var tios:TermIOS); cdecl; external 'c' name 'cfmakeraw';
81
Function TCSendBreak(fd,duration:cint):cint;
83
TCSendBreak:=fpIOCtl(fd,TIOCSBRK,nil);
87
Function TCSetPGrp(fd,id:cint):cint;
89
TCSetPGrp:=fpIOCtl(fd,TIOCSPGRP,pointer(id));
93
Function TCGetPGrp(fd:cint;var id:cint):cint;
95
TCGetPGrp:=fpIOCtl(fd,TIOCGPGRP,@id);
98
Function TCDrain(fd:cint):cint;
100
TCDrain:=fpIOCtl(fd,TIOCDRAIN,nil); {Should set timeout to 1 first?}
104
Function TCFlow(fd,act:cint):cint;
107
TCOOFF : TCFlow:=fpIoctl(fd,TIOCSTOP,nil);
108
TCOOn : TCFlow:=fpIOctl(Fd,TIOCStart,nil);
113
Function TCFlush(fd,qsel:cint):cint;
115
TCFlush:=fpIOCtl(fd,TIOCFLUSH,pointer(qsel));
118
Function IsATTY (Handle:cint):cint;
120
Check if the filehandle described by 'handle' is a TTY (Terminal)
125
IsAtty:=TCGetAttr(Handle,t);
129
Function IsATTY(var f: text):cint;
131
Idem as previous, only now for text variables.
134
IsATTY:=IsaTTY(textrec(f).handle);
138
$Log: termiosproc.inc,v $
139
Revision 1.2 2004/02/05 14:00:45 jonas
140
+ some declarations added from other bsds and /usr/include/sys/termios.h
141
to termios.inc and termiosproc.inc (by Karl-Michael Schindler)
142
+ added crt, mouse (because required by keyboard), keyboard, termio,
143
console to Darwin makefile (thanks to the above they now compile,
144
functionality untested)
145
* fixed wrong dependency for sysconst unit (it was always recompiled)
147
Revision 1.1 2004/01/04 20:05:38 jonas
148
* first working version of the Darwin/Mac OS X (for PowerPC) RTL
149
Several non-essential units are still missing, but make cycle works
151
Revision 1.2 2003/12/16 19:43:53 marco
154
Revision 1.1 2003/11/19 17:15:31 marco
155
* termio new includefile