home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / snip9707.zip / EXT_KEYS.H < prev    next >
C/C++ Source or Header  |  1997-07-05  |  7KB  |  222 lines

  1. /* +++Date last modified: 05-Jul-1997 */
  2.  
  3. /*
  4. **  Keyboard I/O header file.
  5. **
  6. **  ext_getch() returns:
  7. **
  8. **           0->255     Normal key
  9. **           256->511   Numeric pad key or Function key
  10. **           512->767   Cursor pad key or Numeric pad
  11. **                      "duplicate" key (Enter, /, *, -, +)
  12. **
  13. **  GetExtKey() returns same as ext_getch() plus shift key state.
  14. **
  15. **  ext_inkey() returns:
  16. **           EOF if no pending keypress,
  17. **           else same values as ext_getch().
  18. **
  19. **  fast_kbhit() returns non-zero if keypress pending.
  20. **
  21. **  fast_kbflush() clears all pending keypresses.
  22. */
  23.  
  24. #ifndef EXT_KEYS__H
  25. #define EXT_KEYS__H
  26.  
  27. int  ext_getch(void);                           /* Ext_Keys.C     */
  28. int  GetExtKey(int *isshift);                   /* Ext_Keys.C     */
  29. int  fast_kbhit_dos(void);                      /* Faskbhit.C     */
  30. void fast_kbflush_dos(void);                    /* Faskbhit.C     */
  31. int  fast_kbhit_os2(void);                      /* Faskbhit.C     */
  32. void fast_kbflush_os2(void);                    /* Faskbhit.C     */
  33. int  ext_inkey(void);                           /* Faskbhit.C     */
  34.  
  35. #if defined(__OS2__)
  36.  #define fast_kbhit()   fast_kbhit_os2()
  37.  #define fast_kbflush() fast_kbflush_os2()
  38. #else /* Assume DOS */
  39.  #define fast_kbhit()   fast_kbhit_dos()
  40.  #define fast_kbflush() fast_kbflush_dos()
  41. #endif
  42.  
  43. #define Key_ESC         0x1b        /* ASCII codes                */
  44. #define Key_ENTER       '\r'
  45. #define Key_TAB         '\t'
  46. #define Key_BACKSPC     '\b'
  47. #define Key_NL          '\n'
  48. #define Key_LFEED       '\n'
  49. #define Key_FFEED       '\f'
  50.  
  51. #define Key_F1          0x13b       /* Function keys              */
  52. #define Key_F2          0x13c
  53. #define Key_F3          0x13d
  54. #define Key_F4          0x13e
  55. #define Key_F5          0x13f
  56. #define Key_F6          0x140
  57. #define Key_F7          0x141
  58. #define Key_F8          0x142
  59. #define Key_F9          0x143
  60. #define Key_F10         0x144
  61. #define Key_F11         0x185
  62. #define Key_F12         0x186
  63.  
  64. #define Key_CF1         0x15e       /* Ctrl-Function keys         */
  65. #define Key_CF2         0x15f
  66. #define Key_CF3         0x160
  67. #define Key_CF4         0x161
  68. #define Key_CF5         0x162
  69. #define Key_CF6         0x163
  70. #define Key_CF7         0x164
  71. #define Key_CF8         0x165
  72. #define Key_CF9         0x166
  73. #define Key_CF10        0x167
  74. #define Key_CF11        0x189
  75. #define Key_CF12        0x18a
  76.  
  77. #define Key_SF1         0x154       /* Shift-Function keys        */
  78. #define Key_SF2         0x155
  79. #define Key_SF3         0x156
  80. #define Key_SF4         0x157
  81. #define Key_SF5         0x158
  82. #define Key_SF6         0x159
  83. #define Key_SF7         0x15a
  84. #define Key_SF8         0x15b
  85. #define Key_SF9         0x15c
  86. #define Key_SF10        0x15d
  87. #define Key_SF11        0x187
  88. #define Key_SF12        0x188
  89.  
  90. #define Key_AF1         0x168       /* Alt-Function keys          */
  91. #define Key_AF2         0x169
  92. #define Key_AF3         0x16a
  93. #define Key_AF4         0x16b
  94. #define Key_AF5         0x16c
  95. #define Key_AF6         0x16d
  96. #define Key_AF7         0x16e
  97. #define Key_AF8         0x16f
  98. #define Key_AF9         0x170
  99. #define Key_AF10        0x171
  100. #define Key_AF11        0x18b
  101. #define Key_AF12        0x18c
  102.  
  103. #define Key_INS         0x152       /* Numeric pad keys           */
  104. #define Key_DEL         0x153
  105. #define Key_HOME        0x147
  106. #define Key_END         0x14f
  107. #define Key_PGUP        0x149
  108. #define Key_PGDN        0x151
  109. #define Key_UPARROW     0x148
  110. #define Key_DNARROW     0x150
  111. #define Key_LTARROW     0x14b
  112. #define Key_RTARROW     0x14d
  113. #define Key_PADMIDDLE   0x14c
  114.  
  115. #define Key_PADEQ       0x3d        /* Numeric pad grey keys      */
  116. #define Key_PADPLUS     0x22b
  117. #define Key_PADMINUS    0x22d
  118. #define Key_PADASTERISK 0x22a
  119. #define Key_PADSLASH    0x22f
  120. #define Key_PADENTER    0x20d
  121.  
  122. #define Key_CEND        0x175       /* Ctrl-Numeric pad keys      */
  123. #define Key_CDNARROW    0x191
  124. #define Key_CPGDN       0x176
  125. #define Key_CLTARROW    0x173
  126. #define Key_CPADMIDDLE  0x18f
  127. #define Key_CRTARROW    0x174
  128. #define Key_CHOME       0x177
  129. #define Key_CUPARROW    0x18d
  130. #define Key_CPGUP       0x184
  131. #define Key_CINS        0x192
  132. #define Key_CDEL        0x193
  133.  
  134. #define Key_PINS        0x252       /* Cursor pad keys            */
  135. #define Key_PDEL        0x253
  136. #define Key_PHOME       0x247
  137. #define Key_PEND        0x24f
  138. #define Key_PPGUP       0x249
  139. #define Key_PPGDN       0x251
  140. #define Key_PUPARROW    0x248
  141. #define Key_PDNARROW    0x250
  142. #define Key_PLTARROW    0x24b
  143. #define Key_PRTARROW    0x24d
  144.  
  145. #define Key_CPEND       0x275       /* Ctrl-Cursor pad keys       */
  146. #define Key_CPDNARROW   0x291
  147. #define Key_CPPGDN      0x276
  148. #define Key_CPLTARROW   0x273
  149. #define Key_CPRTARROW   0x274
  150. #define Key_CPHOME      0x277
  151. #define Key_CPUPARROW   0x28d
  152. #define Key_CPPGUP      0x284
  153. #define Key_CPINS       0x292
  154. #define Key_CPDEL       0x293
  155.  
  156. #define Key_ALTPSLASH   0x1a4       /* Alt-numeric pad grey keys  */
  157. #define Key_ALTPASTRSK  0x137
  158. #define Key_ALTPMINUS   0x14a
  159. #define Key_ALTPPLUS    0x14e
  160. #define Key_ALTPEQUALS  0x183
  161. #define Key_ALTPENTER   0x1a6
  162.  
  163. #define Key_ALTBACKSPC  0x10e       /* Special PC keyboard keys   */
  164. #define Key_CTRLBACKSPC 0x7f
  165. #define Key_SHIFTTAB    0x10f
  166. #define Key_CTRLTAB     0x194
  167. #define Key_ALTESC      0x101
  168.  
  169. #define Key_ALT1        0x178       /* Alt keys - number row      */
  170. #define Key_ALT2        0x179
  171. #define Key_ALT3        0x17a
  172. #define Key_ALT4        0x17b
  173. #define Key_ALT5        0x17c
  174. #define Key_ALT6        0x17d
  175. #define Key_ALT7        0x17e
  176. #define Key_ALT8        0x17f
  177. #define Key_ALT9        0x180
  178. #define Key_ALT0        0x181
  179. #define Key_ALTMINUS    0x182
  180. #define Key_ALTEQUALS   0x183
  181.  
  182. #define Key_ALTQ        0x110       /* Alt keys - top alpha row   */
  183. #define Key_ALTW        0x111
  184. #define Key_ALTE        0x112
  185. #define Key_ALTR        0x113
  186. #define Key_ALTT        0x114
  187. #define Key_ALTY        0x115
  188. #define Key_ALTU        0x116
  189. #define Key_ALTI        0x117
  190. #define Key_ALTO        0x118
  191. #define Key_ALTP        0x119
  192. #define Key_ALTLBRACE   0x11a
  193. #define Key_ALTRBRACE   0x11b
  194.  
  195. #define Key_ALTA        0x11e       /* Alt keys - mid alpha row   */
  196. #define Key_ALTS        0x11F
  197. #define Key_ALTD        0x120
  198. #define Key_ALTF        0x121
  199. #define Key_ALTG        0x122
  200. #define Key_ALTH        0x123
  201. #define Key_ALTJ        0x124
  202. #define Key_ALTK        0x125
  203. #define Key_ALTL        0x126
  204. #define Key_ALTCOLON    0x127
  205. #define Key_ALTQUOTE    0x128
  206. #define Key_ALTENTER    0x11c
  207.  
  208. #define Key_ALTZ        0x12c       /* Alt keys - lower alpha row */
  209. #define Key_ALTX        0x12d
  210. #define Key_ALTC        0x12e
  211. #define Key_ALTV        0x12f
  212. #define Key_ALTB        0x130
  213. #define Key_ALTN        0x131
  214. #define Key_ALTM        0x132
  215. #define Key_ALTCOMMA    0x133
  216. #define Key_ALTPERIOD   0x134
  217. #define Key_ALTSLASH    0x135
  218. #define Key_ALTBSLASH   0x12b
  219. #define Key_ALTTILDE    0x129
  220.  
  221. #endif /* EXT_KEYS__H */
  222.