console.pas 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. {
  2. This file is part of the Free Pascal run time library.
  3. A file in Amiga system run time library.
  4. Copyright (c) 1998-2003 by Nils Sjoholm
  5. member of the Amiga RTL development team.
  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. {
  13. To call the two routines defined below, you'll need to set
  14. ConsoleBase to an appropriate value.
  15. [email protected] Nils Sjoholm
  16. }
  17. {$IFNDEF FPC_DOTTEDUNITS}
  18. unit console;
  19. {$ENDIF FPC_DOTTEDUNITS}
  20. interface
  21. {$IFDEF FPC_DOTTEDUNITS}
  22. uses
  23. Amiga.Core.Exec, Amiga.Core.Inputevent, Amiga.Core.Keymap;
  24. {$ELSE FPC_DOTTEDUNITS}
  25. uses
  26. exec, inputevent, keymap;
  27. {$ENDIF FPC_DOTTEDUNITS}
  28. const
  29. {***** Console commands *****}
  30. CD_ASKKEYMAP = CMD_NONSTD + 0;
  31. CD_SETKEYMAP = CMD_NONSTD + 1;
  32. CD_ASKDEFAULTKEYMAP = CMD_NONSTD + 2;
  33. CD_SETDEFAULTKEYMAP = CMD_NONSTD + 3;
  34. {***** SGR parameters *****}
  35. SGR_PRIMARY = 0;
  36. SGR_BOLD = 1;
  37. SGR_ITALIC = 3;
  38. SGR_UNDERSCORE = 4;
  39. SGR_NEGATIVE = 7;
  40. SGR_NORMAL = 22; // default foreground color, not bold
  41. SGR_NOTITALIC = 23;
  42. SGR_NOTUNDERSCORE = 24;
  43. SGR_POSITIVE = 27;
  44. { these names refer to the ANSI standard, not the implementation }
  45. SGR_BLACK = 30;
  46. SGR_RED = 31;
  47. SGR_GREEN = 32;
  48. SGR_YELLOW = 33;
  49. SGR_BLUE = 34;
  50. SGR_MAGENTA = 35;
  51. SGR_CYAN = 36;
  52. SGR_WHITE = 37;
  53. SGR_DEFAULT = 39;
  54. SGR_BLACKBG = 40;
  55. SGR_REDBG = 41;
  56. SGR_GREENBG = 42;
  57. SGR_YELLOWBG = 43;
  58. SGR_BLUEBG = 44;
  59. SGR_MAGENTABG = 45;
  60. SGR_CYANBG = 46;
  61. SGR_WHITEBG = 47;
  62. SGR_DEFAULTBG = 49;
  63. { these names refer to the implementation, they are the preferred }
  64. { names for use with the Amiga console device. }
  65. SGR_CLR0 = 30;
  66. SGR_CLR1 = 31;
  67. SGR_CLR2 = 32;
  68. SGR_CLR3 = 33;
  69. SGR_CLR4 = 34;
  70. SGR_CLR5 = 35;
  71. SGR_CLR6 = 36;
  72. SGR_CLR7 = 37;
  73. SGR_CLR0BG = 40;
  74. SGR_CLR1BG = 41;
  75. SGR_CLR2BG = 42;
  76. SGR_CLR3BG = 43;
  77. SGR_CLR4BG = 44;
  78. SGR_CLR5BG = 45;
  79. SGR_CLR6BG = 46;
  80. SGR_CLR7BG = 47;
  81. {***** DSR parameters *****}
  82. DSR_CPR = 6;
  83. {***** CTC parameters *****}
  84. CTC_HSETTAB = 0;
  85. CTC_HCLRTAB = 2;
  86. CTC_HCLRTABSALL = 5;
  87. {***** TBC parameters *****}
  88. TBC_HCLRTAB = 0;
  89. TBC_HCLRTABSALL = 3;
  90. {***** SM and RM parameters *****}
  91. M_LNM = 20; // linefeed newline mode
  92. M_ASM = '>1'; // auto scroll mode
  93. M_AWM = '?7'; // auto wrap mode
  94. var
  95. ConsoleDevice: PDevice = nil;
  96. IConsoleDevice: Pointer = nil;
  97. function CDInputHandler(Events: PInputEvent; ConsoleDev: PLibrary): PInputEvent; syscall IConsoleDevice 76;
  98. function RawKeyConvert(Events: PInputEvent; Buffer: PAnsiChar; Length: LongInt; KeyMap: PKeyMap): LongInt; syscall IConsoleDevice 80;
  99. function GetConSnip(): APTR; syscall ConsoleDevice 9;
  100. function SetConSnip(Param: APTR): LongInt; syscall ConsoleDevice 10;
  101. procedure AddConSnipHook(Hook: PHook); syscall ConsoleDevice 11;
  102. procedure RemConSnipHook(Hook: PHook); syscall ConsoleDevice 12;
  103. implementation
  104. end.