ncrt.pp 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. 2.07 | 01/31/00 | kjw | See ncrt.inc, ocrt.pp
  26. ------------------------------------------------------------------------------
  27. }
  28. Interface
  29. Uses linux,ncurses;
  30. {$i ncrt.inc}
  31. Begin
  32. { load the color pairs array with color pair indices (0..63) }
  33. For bg := 0 to 7 Do For fg := 0 to 7 do cp[bg,fg] := (bg*8)+fg;
  34. { initialize ncurses }
  35. If Not StartCurses(ActiveWn) Then
  36. Halt;
  37. SubWn := nil;
  38. TextMode(LastMode);
  39. { Redirect the standard output }
  40. assigncrt(Output);
  41. Rewrite(Output);
  42. TextRec(Output).Handle:=StdOutputHandle;
  43. { Redirect the standard input }
  44. assigncrt(Input);
  45. Reset(Input);
  46. TextRec(Input).Handle:=StdInputHandle;
  47. { set the unit exit procedure }
  48. ExitSave := ExitProc;
  49. ExitProc := @nExit;
  50. End. { of Unit nCrt }