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.

194 lines
5.6 KiB

  1. /* File: \wacker\emu\emudec.hh (Created: 29-Jan-1998)
  2. *
  3. * Copyright 1998 by Hilgraeve Inc. -- Monroe, MI
  4. * All rights reserved
  5. *
  6. * $Revision: 3 $
  7. * $Date: 7/20/01 5:56p $
  8. */
  9. // The maximum number of user defined keys. Used by the VT220 and VT320.
  10. //
  11. #define MAX_UDK_KEYS 15
  12. #define MAX_KEY_SPACE 256
  13. // These constants are state table states used when processing user
  14. // defined keys for the VT220 and VT320.
  15. //
  16. #define KEY_NUMBER_NEXT 0
  17. #define KEY_DIGIT2_NEXT 1
  18. #define SLASH_NEXT 2
  19. #define CHAR_DIGIT1_NEXT 3
  20. #define CHAR_DIGIT2_NEXT 4
  21. #define ESC_SEEN 5
  22. // The following key data structures are used only for user-defined
  23. // keys in HTPE. But in shared code, they completely replace all
  24. // key data structures. In shared code, these definitios are in
  25. // \shared\emulator\emu.hh
  26. // Key table structure definitions. These are conditionally defined
  27. // so the debug version of the program can supply additional information
  28. // for testing. In the debug version, when the user
  29. // presses the F1 key, we can output the name of the key "HVK_F1" and
  30. // the sequence that is assigned to that key. The KEYDEF macro defined
  31. // below is used in the initialization of the emulator key tables, found
  32. // in each emulator's initialize function. See John Masters for more
  33. // details.
  34. //
  35. #if defined(_DEBUG)
  36. typedef struct
  37. {
  38. KEYDEF Key;
  39. TCHAR * pSequence;
  40. unsigned int iSequenceLen;
  41. TCHAR * pszKeyName;
  42. } STEMUKEYDATA;
  43. #define EMUKEY(K, V, C, A, S, E, SEQ, L) \
  44. { K | (V ? VIRTUAL_KEY : 0) | (C ? CTRL_KEY : 0) | \
  45. (A ? ALT_KEY : 0) | (S ? SHIFT_KEY : 0) | (E ? EXTENDED_KEY : 0), \
  46. { TEXT(SEQ) }, {L}, {#K} }
  47. //{ {K, V, C, A, S, E}, { TEXT(SEQ) }, {L}, {#K} }
  48. #else
  49. typedef struct
  50. {
  51. KEYDEF Key;
  52. TCHAR * pSequence;
  53. unsigned int iSequenceLen;
  54. } STEMUKEYDATA;
  55. #define EMUKEY(K, V, C, A, S, E, SEQ, L) \
  56. { K | (V ? VIRTUAL_KEY : 0) | (C ? CTRL_KEY : 0) | \
  57. (A ? ALT_KEY : 0) | (S ? SHIFT_KEY : 0) | (E ? EXTENDED_KEY : 0), \
  58. { TEXT(SEQ) }, {L} }
  59. //{ {K, V, C, A, S, E}, { TEXT(SEQ) }, {L} }
  60. #endif
  61. typedef STEMUKEYDATA const * PSTCEMUKEYDATA;
  62. typedef STEMUKEYDATA * PSTEMUKEYDATA;
  63. // Private emulator data for DEC Terminals.
  64. //
  65. typedef struct stPrivateDEC
  66. {
  67. int sv_row,
  68. sv_col,
  69. sv_state,
  70. sv_AWM,
  71. sv_DECOM,
  72. sv_protectmode,
  73. fAttrsSaved,
  74. len_s,
  75. len_t,
  76. nState,
  77. gn,
  78. old_gl,
  79. gl,
  80. gr,
  81. sv_gr,
  82. sv_gl,
  83. fDecColHold,
  84. *aiLineAttr;
  85. ECHAR storage[40],
  86. vt_charset[4],
  87. vt_sv_charset[4],
  88. terminate[4],
  89. *pntr;
  90. STATTR sv_attr;
  91. #if defined(INCL_VT220)
  92. PSTCEMUKEYDATA pstcEmuKeyTbl1,
  93. pstcEmuKeyTbl2,
  94. pstcEmuKeyTbl3,
  95. pstcEmuKeyTbl4,
  96. pstcEmuKeyTbl5,
  97. pstcEmuKeyTbl6;
  98. int iKeyTable1Entries,
  99. iKeyTable2Entries,
  100. iKeyTable3Entries,
  101. iKeyTable4Entries,
  102. iKeyTable5Entries,
  103. iKeyTable6Entries;
  104. // A pointer to a table of user defined keys,
  105. //
  106. PSTEMUKEYDATA pstUDK;
  107. int iUDKTableEntries;
  108. // This variable is a state variable used in the processing of
  109. // user defined keys in the VT220 and VT320.
  110. //
  111. int iUDKState,
  112. iUDKTableIndex,
  113. iUDKSequenceLen;
  114. // A flag that is used identify the locked or unlocked status
  115. // of the UDK's, after they are defined. See emuDecClearUDK.
  116. //
  117. int fUnlockedUDK;
  118. // A temporary buffer to collect the user defined key sequence as
  119. // it is being processed.
  120. //
  121. TCHAR acUDKSequence[MAX_KEY_SPACE];
  122. TCHAR chUDKAssignment;
  123. TCHAR const *pacUDKSelectors;
  124. #endif
  125. #if defined(INCL_VTUTF8)
  126. ECHAR echUTF8CodeInProgress;
  127. #endif
  128. } DECPRIVATE;
  129. typedef DECPRIVATE *PSTDECPRIVATE;
  130. // From vt220ini.c
  131. void vt220_init(const HHEMU hhEmu);
  132. // From vt220.c
  133. void vt220_DA(const HHEMU hhEmu);
  134. void vt220_hostreset(const HHEMU hhEmu);
  135. void vt100_printcmnds(const HHEMU hhEmu);
  136. void emuDecClearUDK(const HHEMU hhEmu);
  137. void vt220_softreset(const HHEMU hhEmu);
  138. void vt220_2ndDA(const HHEMU hhEmu);
  139. void vt220_definekey(const HHEMU hhEmu);
  140. void vt220_level(const HHEMU hhEmu);
  141. void vt220_protmode(const HHEMU hhEmu);
  142. int vt220_reset(const HHEMU hhEmu, const int host_request);
  143. void vt220mode_reset(const HHEMU hhEmu);
  144. void vt220_savekeys(const HHEMU hhEmu, const int iSave);
  145. void emuDecSendKeyString(const HHEMU hhEmu,
  146. const int iIndex,
  147. PSTCEMUKEYDATA pstcKeyTbl,
  148. const int iMaxEntries);
  149. void emuDecDefineUDK(const HHEMU hhEmu);
  150. int emuDecStoreUDK(const HHEMU hhEmu);
  151. int emuDecKeyboardIn(const HHEMU hhEmu, int Key,
  152. const int fTest);
  153. int emuDecKbdKeyLookup(const HHEMU hhEmu,
  154. const KEYDEF Key, PSTCEMUKEYDATA pstKeyTbl,
  155. const int iMaxEntries);
  156. void emuDecSendKeyString(const HHEMU hhEmu, const int iIndex,
  157. PSTCEMUKEYDATA pstcKeyTbl, const int iMaxEntries);
  158. void emuVT220SendKeyString(const HHEMU hhEmu,
  159. const int iIndex, PSTCEMUKEYDATA pstcKeyTbl,
  160. const int iMaxEntries);
  161. void emuDecEL(const HHEMU hhEmu);
  162. void emuDecClearLine(const HHEMU hhEmu, const int iClearSelect);
  163. void emuVT220ED(const HHEMU hhEmu);
  164. void emuDecEraseScreen(const HHEMU hhEmu, const int iClearSelect);
  165. void emuDecClearImageRowSelective(const HHEMU hhEmu, const int iImageRow);
  166. void emuDecUnload(const HHEMU hhEmu);