Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

247 lines
8.7 KiB

  1. /* File: D:\WACKER\emu\emu.h (Created: 08-Dec-1993)
  2. *
  3. * Copyright 1994, 1998 by Hilgraeve Inc. -- Monroe, MI
  4. * All rights reserved
  5. *
  6. * $Revision: 7 $
  7. * $Date: 12/27/01 11:13a $
  8. */
  9. #include "..\tdll\features.h"
  10. /* Emulator ID's */
  11. // Don't ever change emulator id numbers. They are stored in session files
  12. // and as such are cast in stone. - mrw,4/13/95
  13. //
  14. #define EMU_AUTO 100
  15. #define EMU_ANSI 101
  16. #define EMU_MINI 102
  17. #define EMU_VIEW 109
  18. #define EMU_TTY 110
  19. #define EMU_VT100 111
  20. #define EMU_VT220 112 // rde:23 Jan 98
  21. #define EMU_VT320 113 // rde:23 Jan 98
  22. #define EMU_VT52 115
  23. #define EMU_VT100J 116
  24. #define EMU_ANSIW 117
  25. #define EMU_VT100PLUS 118 // REV: 02/28/2001
  26. #define EMU_VTUTF8 119 // REV: 02/28/2001
  27. #define NBR_EMULATORS 13
  28. /* Emulator constants */
  29. // Note: if you change MAX_EMUROWS or MAX_EMUCOLS also change
  30. // TERM_ROWS and TERM_COLS in term.hh to match - mrw
  31. // Note: Can't find TERM_ROWS and TERM_COLS. rde 10 Jun 98
  32. #define MAX_EMUROWS 50 // Largest vertical size for emulator.
  33. #define MAX_EMUCOLS 132 // Largest horizontal size for emulator.
  34. #define MIN_EMUROWS 10 // Smallest allowable value for rows,
  35. #define MIN_EMUCOLS 20 // and columns.
  36. #define EMU_DEFAULT_COLS 80
  37. #define EMU_DEFAULT_ROWS 24
  38. #define EMU_OK 0
  39. #define TRM_NUMSTRIPCHARS 3
  40. #define EMU_MAX_NAMELEN 15
  41. #define EMU_MAX_AUTODETECT_ATTEMPTS 10
  42. #define EMU_MAX_TELNETID 256
  43. // JCM should remove the two defines below.
  44. //
  45. #define EMU_DEFAULT_MAXCOL 79
  46. #define EMU_DEFAULT_MAXROW 23
  47. #define EMU_KEYS_ACCEL 0
  48. #define EMU_KEYS_TERM 1
  49. #define EMU_KEYS_SCAN 2
  50. #define EMU_CURSOR_BLOCK 1
  51. #define EMU_CURSOR_LINE 2
  52. #define EMU_CURSOR_NONE 3
  53. #define EMU_CHARSET_ASCII 0
  54. #define EMU_CHARSET_UK 1
  55. #define EMU_CHARSET_SPECIAL 2
  56. #define EMU_CHARSET_MULTINATIONAL 3
  57. #define EMU_CHARSET_FRENCH 4
  58. #define EMU_CHARSET_FRENCHCANADIAN 5
  59. #define EMU_CHARSET_GERMAN 6
  60. #define EMU_EVENT_CONNECTED 1
  61. #define EMU_EVENT_DISCONNECTED 2
  62. #define EMU_EVENT_CONNECTING 3
  63. #define EMU_BKSPKEYS_CTRLH 1
  64. #define EMU_BKSPKEYS_DEL 2
  65. #define EMU_BKSPKEYS_CTRLHSPACE 3
  66. // 8 bits just ain't enough anymore. Going to bit fields to handle
  67. // things like text marking, blinking, underlining, etc. Also can
  68. // handle more colors this way if we want. For now though stick to
  69. // original scheme of 4 bits for foreground color and 4 bits for
  70. // background color.
  71. struct stAttribute
  72. {
  73. unsigned int txtclr : 4; // text or foreground color index.
  74. unsigned int bkclr : 4; // background color index.
  75. unsigned int txtmrk : 1; // true if text is 'marked'.
  76. unsigned int undrln : 1; // underline
  77. unsigned int hilite : 1; // foreground intensity
  78. unsigned int bklite : 1; // background intensity
  79. unsigned int blink : 1; // soon to be famous blink attribute
  80. unsigned int revvid : 1; // reverse video
  81. unsigned int blank : 1; // blank attribute
  82. unsigned int dblwilf: 1; // double wide left
  83. unsigned int dblwirt: 1; // double wide right
  84. unsigned int dblhilo: 1; // double height top half
  85. unsigned int dblhihi: 1; // double height bottom half
  86. unsigned int protect: 1; // protected bit for DEC emulators.
  87. unsigned int symbol: 1; // use symbol font
  88. unsigned int wilf : 1; // wide left
  89. unsigned int wirt : 1; // wide right
  90. };
  91. typedef struct stAttribute STATTR;
  92. typedef STATTR *PSTATTR;
  93. // Note: This structure is now used only internally to the program--it is
  94. // no longer used to load in and save out data in the session file.
  95. // Consequently, it is safe to add and remove items at will. rde 8 Jun 98
  96. struct emuSettings
  97. {
  98. int nEmuId, // 100 = EMU_AUTO
  99. // 101 = EMU_ANSI
  100. // 102 = EMU_MINI
  101. // 109 = EMU_VIEW
  102. // 110 = EMU_TTY
  103. // 111 = EMU_VT100
  104. // 112 = EMU_VT220
  105. // 113 = EMU_VT320
  106. // 115 = EMU_VT52
  107. // 116 = EMU_VT100J
  108. // 117 = EMU_ANSIW
  109. // 118 = EMU_VT100PLUS
  110. // 119 = EMU_VTUTF8
  111. //
  112. nTermKeys, // 0 = EMU_KEYS_ACCEL
  113. // 1 = EMU_KEYS_TERM
  114. // 2 = EMU_KEYS_SCAN
  115. //
  116. nCursorType, // 1 = EMU_CURSOR_BLOCK
  117. // 2 = EMU_CURSOR_LINE
  118. // 3 = EMU_CURSOR_NONE
  119. //
  120. nCharacterSet, // 0 = EMU_CHARSET_ASCII
  121. // 1 = EMU_CHARSET_UK
  122. // 2 = EMU_CHARSET_SPECIAL
  123. //
  124. nAutoAttempts, // Count of connections using the Auto
  125. // Detect Emulator. At
  126. // EMU_MAX_AUTODETECT_ATTEMPTS, we switch
  127. // to Ansi emulation. Note, this may
  128. // get moved into a Statictics Handle
  129. // if we ever develop one.
  130. //
  131. fCursorBlink, // Blinking cursor. True\False.
  132. fMapPFkeys, // PF1-PF4 to top row of keypad.True\False.
  133. fAltKeypadMode, // Alternate keypad mode. True\False.
  134. fKeypadAppMode, // Keypad application mode. True\False.
  135. fCursorKeypadMode, // Cursor keypad mode. True\Fales.
  136. fReverseDelBk, // Reverse Del and Backsp. True\False.
  137. f132Columns, // 132 column display. True\False.
  138. fDestructiveBk, // Destructive backspace. True\False.
  139. fWrapLines, // Wrap lines. True\False.
  140. fLbSymbolOnEnter, // Send # symbol on Enter. True\False.
  141. // Note: The following two variables were added for the VT220/320. rde:24 Jan 98
  142. fUse8BitCodes, // 8-bit control codes True\False.
  143. fAllowUserKeys; // User defined keys allowed True\False.
  144. #if defined(INCL_PRINT_PASSTHROUGH)
  145. // Note: The following variable was added for VT100/220/320. mpt:5-18-00
  146. int fPrintRaw; // Do not use windows print drv True\False.
  147. #endif // INCL_PRINT_PASSTHROUGH
  148. #ifdef INCL_TERMINAL_SIZE_AND_COLORS
  149. // The following four variables were added for user settable
  150. // terminal screen size and colors. rde 1 Jun 98
  151. int nTextColor, // Default text color. 0 thru 15.
  152. nBackgroundColor, // Default background color. 0 thru 15.
  153. nUserDefRows, // Number of terminal rows. 12 thru 50.
  154. nUserDefCols; // Number of terminal columns. 40 thru 132.
  155. #endif
  156. // Note: The following two variables are only used if the "Include
  157. // User Defined Backspace and Telnet Terminal Id" feature is enabled.
  158. // There is no compile switch here because this entire structure gets
  159. // written to the session file in one large chunk. Using a compile
  160. // switch could potentially cause version problems later on down
  161. // the road. - cab:11/15/96
  162. //
  163. int nBackspaceKeys; // 1 = EMU_BKSPKEYS_CTRLH
  164. // 2 = EMU_BKSPKEYS_DEL
  165. // 3 = EMU_BKSPKEYS_CTRLHSPACE
  166. TCHAR acTelnetId[EMU_MAX_TELNETID]; // Telnet terminal ID
  167. };
  168. typedef struct emuSettings STEMUSET;
  169. typedef STEMUSET *PSTEMUSET;
  170. /* emuhdl.c */
  171. HEMU emuCreateHdl(const HSESSION hSession);
  172. int emuDestroyHdl(const HEMU hEmu);
  173. int emuLoad(const HEMU hEmu, const int nEmuId);
  174. void emuLock(const HEMU hEmu);
  175. void emuUnlock(const HEMU hEmu);
  176. ECHAR **emuGetTxtBuf(const HEMU hEmu);
  177. PSTATTR *emuGetAttrBuf(const HEMU hEmu);
  178. int emuKbdIn(const HEMU hEmu, KEY_T key, const int fTest);
  179. int emuDataIn(const HEMU hEmu, const ECHAR ccode);
  180. int emuComDone(const HEMU hEmu);
  181. int emuTrackingNotify(const HEMU hEmu);
  182. int emuIsEmuKey(const HEMU hEmu, KEY_T key);
  183. int emuQueryClearAttr(const HEMU hemu, PSTATTR pstClearAttr);
  184. int emuQueryCurPos(const HEMU hEmu, int *row, int *col);
  185. HPRINT emuQueryPrintEchoHdl(const HEMU hEmu);
  186. int emuQueryRowsCols(const HEMU hEmu, int *piRows, int *piCols);
  187. int emuQueryEmulatorId(const HEMU hEmulator);
  188. int emuNotify(const HEMU hEmu, const int nEvent);
  189. int emuQueryCursorType(const HEMU hEmu);
  190. int emuQueryName(const HEMU hEmu, TCHAR *achBuffer, int nSize);
  191. int emuSetSettings(const HEMU hEmu, const PSTEMUSET pstSettings);
  192. int emuQuerySettings(const HEMU hEmu, PSTEMUSET pstSettings);
  193. int emuInitializeHdl(const HEMU hEmu);
  194. int emuSaveHdl(const HEMU hEmu);
  195. int emuHomeHostCursor(const HEMU hEmu);
  196. int emuEraseTerminalScreen(const HEMU hEmu);
  197. void emuMinitelSendKey(const HEMU hEmu, const int iCmd); // minitel.c
  198. int emuGetIdFromName(const HEMU hEmu, TCHAR *achEmuName);
  199. int emuQueryDefaultTelnetId(const int nEmuId, TCHAR *achTelnetId, int nSize);
  200. int emuLoadDefaultTelnetId(const HEMU hEmu);
  201. /* colors indexes */
  202. #define VC_BLACK 0
  203. #define VC_BLUE 1
  204. #define VC_GREEN 2
  205. #define VC_CYAN 3
  206. #define VC_RED 4
  207. #define VC_MAGENTA 5
  208. #define VC_BROWN 6
  209. #define VC_WHITE 7
  210. #define VC_GRAY 8
  211. #define VC_BRT_BLUE 9
  212. #define VC_BRT_GREEN 10
  213. #define VC_BRT_CYAN 11
  214. #define VC_BRT_RED 12
  215. #define VC_BRT_MAGENTA 13
  216. #define VC_BRT_YELLOW 14
  217. #define VC_BRT_WHITE 15