~ubuntu-branches/debian/lenny/fpc/lenny

« back to all changes in this revision

Viewing changes to rtl/darwin/termiosproc.inc

  • Committer: Bazaar Package Importer
  • Author(s): Mazen Neifer, Torsten Werner, Mazen Neifer
  • Date: 2008-05-17 17:12:11 UTC
  • mfrom: (3.1.9 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080517171211-9qi33xhd9evfa0kg
Tags: 2.2.0-dfsg1-9
[ Torsten Werner ]
* Add Mazen Neifer to Uploaders field.

[ Mazen Neifer ]
* Moved FPC sources into a version dependent directory from /usr/share/fpcsrc
  to /usr/share/fpcsrc/${FPCVERSION}. This allow installing more than on FPC
  release.
* Fixed far call issue in compiler preventing building huge binearies.
  (closes: #477743)
* Updated building dependencies, recomennded and suggested packages.
* Moved fppkg to fp-utils as it is just a helper tool and is not required by
  compiler.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
{
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.
6
 
 
7
 
    See the file COPYING.FPC, included in this distribution,
8
 
    for details about the copyright.
9
 
 
10
 
    This file contains the implementation of several termio(s) functions
11
 
 
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.
15
 
 
16
 
 **********************************************************************}
17
 
 
18
 
{******************************************************************************
19
 
                         IOCtl and Termios calls
20
 
******************************************************************************}
21
 
 
22
 
Function TCGetAttr(fd:cint;var tios:TermIOS):cint;
23
 
begin
24
 
  TCGETAttr:=fpIoCtl(Fd,TIOCGETA,@tios);
25
 
end;
26
 
 
27
 
Function TCSetAttr(fd:cint;OptAct:cint;const tios:TermIOS):cint;
28
 
var
29
 
  nr:cint;
30
 
begin
31
 
  case OptAct of
32
 
   TCSANOW   : nr:=TIOCSETA;
33
 
   TCSADRAIN : nr:=TIOCSETAW;
34
 
   TCSAFLUSH : nr:=TIOCSETAF;
35
 
  else
36
 
   begin
37
 
     fpsetErrNo(ESysEINVAL);
38
 
     TCSetAttr:=-1;
39
 
     exit;
40
 
   end;
41
 
  end;
42
 
  TCSetAttr:=fpIOCtl(fd,nr,@Tios);
43
 
end;
44
 
 
45
 
Procedure CFSetISpeed(var tios:TermIOS;speed:Cardinal);
46
 
begin
47
 
  tios.c_ispeed:=speed; {Probably the Bxxxx speed constants}
48
 
end;
49
 
 
50
 
 
51
 
Procedure CFSetOSpeed(var tios:TermIOS;speed:Cardinal);
52
 
begin
53
 
   tios.c_ospeed:=speed;
54
 
end;
55
 
 
56
 
 
57
 
 
58
 
Procedure CFMakeRaw(var tios:TermIOS);
59
 
begin
60
 
  with tios do
61
 
   begin
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
64
 
                IGNPAR));
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);
70
 
     c_cc[VMIN]:=1;
71
 
     c_cc[VTIME]:=0;
72
 
   end;
73
 
end;
74
 
 
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';
80
 
 
81
 
Function TCSendBreak(fd,duration:cint):cint;
82
 
begin
83
 
  TCSendBreak:=fpIOCtl(fd,TIOCSBRK,nil);
84
 
end;
85
 
 
86
 
 
87
 
Function TCSetPGrp(fd,id:cint):cint;
88
 
begin
89
 
  TCSetPGrp:=fpIOCtl(fd,TIOCSPGRP,pointer(id));
90
 
end;
91
 
 
92
 
 
93
 
Function TCGetPGrp(fd:cint;var id:cint):cint;
94
 
begin
95
 
  TCGetPGrp:=fpIOCtl(fd,TIOCGPGRP,@id);
96
 
end;
97
 
 
98
 
Function TCDrain(fd:cint):cint;
99
 
begin
100
 
  TCDrain:=fpIOCtl(fd,TIOCDRAIN,nil); {Should set timeout to 1 first?}
101
 
end;
102
 
 
103
 
 
104
 
Function TCFlow(fd,act:cint):cint;
105
 
begin
106
 
    case act OF
107
 
     TCOOFF :  TCFlow:=fpIoctl(fd,TIOCSTOP,nil);
108
 
     TCOOn  :  TCFlow:=fpIOctl(Fd,TIOCStart,nil);
109
 
     TCIOFF :  {N/I}
110
 
    end;
111
 
end;
112
 
 
113
 
Function TCFlush(fd,qsel:cint):cint;
114
 
begin
115
 
  TCFlush:=fpIOCtl(fd,TIOCFLUSH,pointer(qsel));
116
 
end;
117
 
 
118
 
Function IsATTY (Handle:cint):cint;
119
 
{
120
 
  Check if the filehandle described by 'handle' is a TTY (Terminal)
121
 
}
122
 
var
123
 
  t : Termios;
124
 
begin
125
 
 IsAtty:=TCGetAttr(Handle,t);
126
 
end;
127
 
 
128
 
 
129
 
Function IsATTY(var f: text):cint;
130
 
{
131
 
  Idem as previous, only now for text variables.
132
 
}
133
 
begin
134
 
  IsATTY:=IsaTTY(textrec(f).handle);
135
 
end;
136
 
 
137
 
{
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)
146
 
 
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
150
 
 
151
 
   Revision 1.2  2003/12/16 19:43:53  marco
152
 
    * nil <-> 0 changes
153
 
 
154
 
   Revision 1.1  2003/11/19 17:15:31  marco
155
 
    * termio new includefile
156
 
 
157
 
 
158
 
}