home *** CD-ROM | disk | FTP | other *** search
/ Freelog 22 / freelog 22.iso / Prog / Djgpp / GPC2952B.ZIP / lib / gcc-lib / djgpp / 2.952 / units / turbo3.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2001-02-08  |  2.9 KB  |  123 lines

  1. {
  2. Turbo Pascal 3.0 compatibility unit
  3.  
  4. Copyright (C) 1998-2001 Free Software Foundation, Inc.
  5.  
  6. Author: Frank Heckenbach <frank@pascal.gnu.de>
  7.  
  8. This file is part of GNU Pascal.
  9.  
  10. GNU Pascal is free software; you can redistribute it and/or modify
  11. it under the terms of the GNU General Public License as published by
  12. the Free Software Foundation; either version 2, or (at your option)
  13. any later version.
  14.  
  15. GNU Pascal is distributed in the hope that it will be useful,
  16. but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. GNU General Public License for more details.
  19.  
  20. You should have received a copy of the GNU General Public License
  21. along with GNU Pascal; see the file COPYING. If not, write to the
  22. Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
  23. 02111-1307, USA.
  24.  
  25. As a special exception, if you link this file with files compiled
  26. with a GNU compiler to produce an executable, this does not cause
  27. the resulting executable to be covered by the GNU General Public
  28. License. This exception does not however invalidate any other
  29. reasons why the executable file might be covered by the GNU General
  30. Public License.
  31. }
  32.  
  33. {$gnu-pascal,B-,I-}
  34. {$if __GPC_RELEASE__ < 20000412}
  35. {$error This unit requires GPC release 20000412 or newer.}
  36. {$endif}
  37.  
  38. unit Turbo3;
  39.  
  40. interface
  41.  
  42. uses GPC, System, CRT;
  43.  
  44. var
  45.   Kbd : Text;
  46.   CBreak : Boolean absolute CheckBreak;
  47.  
  48. procedure AssignKbd (var F : (*AnyFile*)Text);
  49. function  (*@@fjf260*)MemAvail3 : Integer;
  50. function  (*@@fjf260*)MaxAvail3 : Integer;
  51. function  LongFileSize (var F : AnyFile) : Real;
  52. function  LongFilePos  (var F : AnyFile) : Real;
  53. procedure LongSeek     (var F : AnyFile; aPosition : Real);
  54. procedure (*@@fjf260*)LowVideo3;
  55. procedure (*@@fjf260*)HighVideo3;
  56.  
  57. implementation
  58.  
  59. function Kbd_Read (var PrivateData; var Buffer; Size : SizeType) = BytesRead : SizeType;
  60. var
  61.   CharBuf : array [1 .. Size] of Char absolute Buffer;
  62.   Dummy : Pointer;
  63. begin
  64.   Dummy := @PrivateData;
  65.   BytesRead := 0;
  66.   repeat
  67.     Inc (BytesRead);
  68.     CharBuf [BytesRead] := ReadKey;
  69.     if CharBuf [BytesRead] = #0 then CharBuf [BytesRead] := chEsc
  70.   until (BytesRead = Size) or not KeyPressed
  71. end;
  72.  
  73. procedure AssignKbd (var F : (*AnyFile*)Text);
  74. begin
  75.   AssignTFDD (F, nil, nil, nil, Kbd_Read, nil, nil, nil, nil, nil)
  76. end;
  77.  
  78. function MemAvail3 : Integer;
  79. begin
  80.   MemAvail3 := MemAvail div 16
  81. end;
  82.  
  83. function MaxAvail3 : Integer;
  84. begin
  85.   MaxAvail3 := MaxAvail div 16
  86. end;
  87.  
  88. function LongFileSize (var F : AnyFile) : Real;
  89. begin
  90.   LongFileSize := FileSize (F)
  91. end;
  92.  
  93. function LongFilePos (var F : AnyFile) : Real;
  94. begin
  95.   LongFilePos := FilePos (F)
  96. end;
  97.  
  98. procedure LongSeek (var F : AnyFile; aPosition : Real);
  99. begin
  100.   Seek (F, Round (aPosition))
  101. end;
  102.  
  103. procedure LowVideo3;
  104. begin
  105.   TextColor (LightGray);
  106.   TextBackground (Black)
  107. end;
  108.  
  109. procedure HighVideo3;
  110. begin
  111.   TextColor (Yellow);
  112.   TextBackground (Black)
  113. end;
  114.  
  115. to begin do
  116. begin
  117.   NormAttr := Yellow + $10 * Black;
  118.   AssignKbd (Kbd);
  119.   Reset (Kbd)
  120. end;
  121.  
  122. end.
  123.