ncrt.pp 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. Unit nCrt;
  2. {---------------------------------------------------------------------------
  3. CncWare
  4. (c) Copyright 1999
  5. Portions copyright the FreePascal Team
  6. ---------------------------------------------------------------------------
  7. Filename..: ncrt.pp
  8. Programmer: Ken J. Wright, [email protected]
  9. Date......: 03/01/99
  10. Purpose - A crt replacement using ncurses.
  11. -------------------------------<< REVISIONS >>--------------------------------
  12. Ver | Date | Prog| Description
  13. -------+----------+-----+-----------------------------------------------------
  14. 1.00 | 03/01/99 | kjw | Initial Release.
  15. ------------------------------------------------------------------------------
  16. 2.00 | 12/13/99 | kjw | nCrt is now a drop-in replacement for the standard
  17. | FPC crt unit. All the previous OOP features have
  18. | been moved to a new unit, oCrt (object crt).
  19. | See oCrt.pp for a complete revision history.
  20. 2.02 | 12/15/99 | kjw | See ncrt.inc.
  21. 2.03 | 12/16/99 | kjw | See ncrt.inc
  22. 2.04 | 01/04/00 | kjw | See ncrt.inc
  23. 2.05 | 01/06/00 | kjw | See ncrt.inc, ocrt.pp
  24. 2.06 | 01/11/00 | kjw | See ncrt.inc.
  25. ------------------------------------------------------------------------------
  26. }
  27. Interface
  28. Uses linux,ncurses;
  29. {$i ncrt.inc}
  30. Begin
  31. { load the color pairs array with color pair indices (0..63) }
  32. For bg := 0 to 7 Do For fg := 0 to 7 do cp[bg,fg] := (bg*8)+fg;
  33. { initialize ncurses }
  34. If Not StartCurses(ActiveWn) Then
  35. Halt;
  36. SubWn := nil;
  37. TextMode(LastMode);
  38. { Redirect the standard output }
  39. assigncrt(Output);
  40. Rewrite(Output);
  41. TextRec(Output).Handle:=StdOutputHandle;
  42. { Redirect the standard input }
  43. assigncrt(Input);
  44. Reset(Input);
  45. TextRec(Input).Handle:=StdInputHandle;
  46. { set the unit exit procedure }
  47. ExitSave := ExitProc;
  48. ExitProc := @nExit;
  49. End. { of Unit nCrt }