1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- {
- $Id$
- This file is part of the Free Pascal Integrated Development Environment
- Copyright (c) 2001 by Pierre Muller
- This unit is used to save and restore console modes
- See the file COPYING.FPC, included in this distribution,
- for details about the copyright.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- **********************************************************************}
- unit WConsole;
- interface
- {$ifdef UNIX}
- uses
- TermInfo,
- {$Ifdef ver1_0}
- linux;
- {$else}
- Unix;
- {$endif}
- {$endif UNIX}
- type
- TConsoleMode =
- {$ifdef UNIX}
- TermIos
- {$endif UNIX}
- {$ifdef Win32}
- dword
- {$endif Win32}
- {$ifdef go32v2}
- longint
- {$endif go32v2}
- ;
- Procedure SaveConsoleMode(var ConsoleMode : TConsoleMode);
- Procedure RestoreConsoleMode(const ConsoleMode : TConsoleMode);
- implementation
- {$ifdef Win32}
- uses
- windows;
- {$endif Win32}
- Procedure SaveConsoleMode(var ConsoleMode : TConsoleMode);
- Begin
- {$ifdef UNIX}
- TCGetAttr(1,ConsoleMode);
- {$endif UNIX}
- {$ifdef Win32}
- GetConsoleMode(GetStdHandle(STD_INPUT_HANDLE),ConsoleMode);
- {$endif Win32}
- {$ifdef go32v2}
- ConsoleMode:=0;
- {$endif go32v2}
- End;
- Procedure RestoreConsoleMode(const ConsoleMode : TConsoleMode);
- Begin
- {$ifdef UNIX}
- TCSetAttr(1,TCSANOW,ConsoleMode);
- {$endif UNIX}
- {$ifdef Win32}
- SetConsoleMode(GetStdHandle(STD_INPUT_HANDLE),ConsoleMode);
- {$endif Win32}
- {$ifdef go32v2}
- {$endif go32v2}
- End;
- end.
- {
- $Log$
- Revision 1.3 2001-10-09 12:10:48 marco
- * fix.
- Revision 1.2 2001/10/02 23:58:51 pierre
- * fix linux code
- Revision 1.1 2001/10/02 23:40:44 pierre
- New unit to preserve console mode
- }
|