wconsole.pas 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. {
  2. $Id$
  3. This file is part of the Free Pascal Integrated Development Environment
  4. Copyright (c) 2001 by Pierre Muller
  5. This unit is used to save and restore console modes
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. unit WConsole;
  13. interface
  14. {$ifdef UNIX}
  15. uses
  16. TermInfo,
  17. {$Ifdef ver1_0}
  18. linux;
  19. {$else}
  20. termio;
  21. {$endif}
  22. {$endif UNIX}
  23. type
  24. TConsoleMode =
  25. {$ifdef OS2}
  26. dword
  27. {$endif OS2}
  28. {$ifdef UNIX}
  29. TermIos
  30. {$endif UNIX}
  31. {$ifdef Win32}
  32. dword
  33. {$endif Win32}
  34. {$ifdef go32v2}
  35. longint
  36. {$endif go32v2}
  37. {$ifdef netwlibc}
  38. longint
  39. {$endif netwlibc}
  40. ;
  41. Procedure SaveConsoleMode(var ConsoleMode : TConsoleMode);
  42. Procedure RestoreConsoleMode(const ConsoleMode : TConsoleMode);
  43. implementation
  44. {$ifdef Win32}
  45. uses
  46. windows;
  47. {$endif Win32}
  48. Procedure SaveConsoleMode(var ConsoleMode : TConsoleMode);
  49. Begin
  50. {$ifdef UNIX}
  51. TCGetAttr(1,ConsoleMode);
  52. {$endif UNIX}
  53. {$ifdef Win32}
  54. GetConsoleMode(GetStdHandle(STD_INPUT_HANDLE),ConsoleMode);
  55. {$endif Win32}
  56. {$ifdef go32v2}
  57. ConsoleMode:=0;
  58. {$endif go32v2}
  59. {$ifdef netwlibc}
  60. ConsoleMode:=0;
  61. {$endif}
  62. End;
  63. Procedure RestoreConsoleMode(const ConsoleMode : TConsoleMode);
  64. Begin
  65. {$ifdef UNIX}
  66. TCSetAttr(1,TCSANOW,ConsoleMode);
  67. {$endif UNIX}
  68. {$ifdef Win32}
  69. SetConsoleMode(GetStdHandle(STD_INPUT_HANDLE),ConsoleMode);
  70. {$endif Win32}
  71. {$ifdef go32v2}
  72. {$endif go32v2}
  73. End;
  74. end.
  75. {
  76. $Log$
  77. Revision 1.7 2004-09-19 14:51:03 armin
  78. * added support for target netwlibc
  79. Revision 1.6 2003/11/19 17:11:40 marco
  80. * termio unit
  81. Revision 1.5 2002/10/12 19:42:01 hajny
  82. + OS/2 support
  83. Revision 1.4 2002/09/07 15:40:48 peter
  84. * old logs removed and tabs fixed
  85. }