home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / UDEL.ZIP / SFKB.H < prev    next >
Text File  |  1988-10-09  |  12KB  |  252 lines

  1. /******************************************************************************
  2. *  sfkb.h  -  standart key board routines for microsoft c under OS/2          *
  3. *                                                                             *
  4. *                                                       07/09/88              *
  5. ******************************************************************************/
  6.  
  7. #define  FKEY1           0x3b             /* unshifted function keys */
  8. #define  FKEY2           0x3c
  9. #define  FKEY3           0x3d
  10. #define  FKEY4           0x3e
  11. #define  FKEY5           0x3f
  12. #define  FKEY6           0x40
  13. #define  FKEY7           0x41
  14. #define  FKEY8           0x42
  15. #define  FKEY9           0x43
  16. #define  FKEY10          0x44
  17. #define  FKEY11          0x85
  18. #define  FKEY12          0x86
  19.  
  20.  
  21. #define  US_FKEY1        0x54            /* Upper shift function keys */
  22. #define  US_FKEY2        0x55
  23. #define  US_FKEY3        0x56
  24. #define  US_FKEY4        0x57
  25. #define  US_FKEY5        0x58
  26. #define  US_FKEY6        0x59
  27. #define  US_FKEY7        0x5a
  28. #define  US_FKEY8        0x5b
  29. #define  US_FKEY9        0x5c
  30. #define  US_FKEY10       0x5d
  31. #define  US_FKEY11       0x87
  32. #define  US_FKEY12       0x88
  33.  
  34.  
  35. #define  ALT_FKEY1       0x68            /* alt function key */
  36. #define  ALT_FKEY2       0x69
  37. #define  ALT_FKEY3       0x6a
  38. #define  ALT_FKEY4       0x6b
  39. #define  ALT_FKEY5       0x6c
  40. #define  ALT_FKEY6       0x6d
  41. #define  ALT_FKEY7       0x6e
  42. #define  ALT_FKEY8       0x6f
  43. #define  ALT_FKEY9       0x70
  44. #define  ALT_FKEY10      0x71
  45. #define  ALT_FKEY11      0x8b
  46. #define  ALT_FKEY12      0x8c
  47.  
  48.  
  49. #define  CTL_FKEY1       0x5e             /* control Function key */
  50. #define  CTL_FKEY2       0x5f
  51. #define  CTL_FKEY3       0x60
  52. #define  CTL_FKEY4       0x61
  53. #define  CTL_FKEY5       0x62
  54. #define  CTL_FKEY6       0x63
  55. #define  CTL_FKEY7       0x64
  56. #define  CTL_FKEY8       0x65
  57. #define  CTL_FKEY9       0x66
  58. #define  CTL_FKEY10      0x67
  59. #define  CTL_FKEY11      0x89
  60. #define  CTL_FKEY12      0x8a
  61.  
  62.  
  63. #define  INSERT_K        0x52
  64. #define  DELETE_K        0x53
  65. #define  HOME_K          0x47
  66. #define  END_K           0x4f
  67. #define  PAGEUP_K        0x49
  68. #define  PAGEDOWN_K      0x51
  69.  
  70.  
  71. #define  ALT_INSERT_K    0x92            /* ALT */
  72. #define  ALT_DELETE_K    0x93
  73. #define  ALT_HOME_K      0x77
  74. #define  ALT_END_K       0x75
  75. #define  ALT_PAGEUP_K    0x84
  76. #define  ALT_PAGEDOWN_K  0x76
  77.  
  78.  
  79. #define  CTL_INSERT_K    0xa2            /* control */
  80. #define  CTL_DELETE_K    0xa3
  81. #define  CTL_HOME_K      0x97
  82. #define  CTL_END_K       0x9f
  83. #define  CTL_PAGEUP_K    0x99
  84. #define  CTL_PAGEDOWN_K  0xa1
  85.  
  86.  
  87. #define  UP_K            0x48            /* arrow pad */
  88. #define  DOWN_K          0x50
  89. #define  RIGHT_K         0x4d
  90. #define  LEFT_K          0x4b
  91.  
  92.  
  93. #define  ALT_UP_K        0x98            /* ALT arrow pad */
  94. #define  ALT_DOWN_K      0xa0
  95. #define  ALT_RIGHT_K     0x9b
  96. #define  ALT_LEFT_K      0x9d
  97.  
  98.  
  99. #define  CTL_UP_K        0x8d           /* CTL arrow pad */
  100. #define  CTL_DOWN_K      0x91
  101. #define  CTL_RIGHT_K     0x73
  102. #define  CTL_LEFT_K      0x74
  103.  
  104. #define  K_WAIT          0            /* wait for key board */
  105. #define  K_NO_WAIT       1            /* no key board wait */
  106.  
  107.                                            /* sfkb_set_shift */
  108. #define   K_CAP_LOCK       0x40            /* sfkb_get_shift */
  109. #define   K_NUM_LOCK       0x20
  110. #define   K_SCROLL_LOCK    0x10
  111.  
  112. #define   K_LEFT_SHIFT     0x02      /* used in sfkb_get_shift  ONLY */
  113. #define   K_RIGHT_SHIFT    0x01
  114. #define   K_ALT            0x08
  115. #define   K_CTL            0x04
  116.  
  117.  
  118. #define   K_ON                1          /* returns of sfkb_get_shift */
  119. #define   K_OFF               0
  120.  
  121.  
  122. #define   K_ECHO_ON         0x01
  123. #define   K_ECHO_OFF        0X02
  124. #define   K_RAW_MODE        0x04
  125. #define   K_COOKED_MODE     0x08
  126.  
  127. #define   K_MODE_ON         0x01
  128. #define   K_MODE_OFF        0x00
  129.  
  130. int sfkb_getch(int *ascii,int *function,int wait);
  131. /****************************************************************************
  132. *  sf_getch  -  passes back the ascii key pressed or function/cursor pad    *
  133. *               keys, only one will be returned other will be zero.         *
  134. *                                                                           *
  135. *     wait :  K_WAIT    =  wait for keyboard input before returning         *
  136. *             K_NO_WAIT =  do not wait for keyboard input before returning  *
  137. *                                                                           *
  138. *             fuction return key stroke value or zero if no key pressed.    *         *
  139. *                                                                           *
  140. *                                                                           *
  141. ****************************************************************************/
  142.  
  143.  
  144. int sfkb_getch_vas(int *ascii,int wait,char *vc);
  145. /****************************************************************************
  146. *  sf_getch_vas       accept ascii key from list of valid char set          *
  147. *                     vc.                                                   *
  148. *                                                                           *
  149. *     wait :  K_WAIT    =  wait for keyboard input before returning         *
  150. *             K_NO_WAIT =  do not wait for keyboard input before returning  *
  151. *                                                                           *
  152. *             fuction return key stroked pressed or 0 if none pressed.      *
  153. *                                                                           *
  154. *                                                                           *
  155. ****************************************************************************/
  156.  
  157.  
  158.  
  159. int sfkb_getch_vfs(int *function,int wait,char *fl);
  160. /****************************************************************************
  161. *  sf_getch_vfs       accept function key from valid set of function keys   *
  162. *                     fl.                                                   *
  163. *                                                                           *
  164. *     wait :  K_WAIT    =  wait for keyboard input before returning         *
  165. *             K_NO_WAIT =  do not wait for keyboard input before returning  *
  166. *                                                                           *
  167. *             fuction return key stroked pressed or 0 if none pressed.      *
  168. *                                                                           *
  169. *                                                                           *
  170. ****************************************************************************/
  171.  
  172.  
  173.  
  174. int sfkb_getch_vafs(int *ascii,int *function,int wait,char *vc,char *fl);
  175. /****************************************************************************
  176. *  sf_getch_vafs      accept ascii or function key from valid list of ascii *
  177. *                     and function keys vc and fl                           *
  178. *                                                                           *
  179. *     wait :  K_WAIT    =  wait for keyboard input before returning         *
  180. *             K_NO_WAIT =  do not wait for keyboard input before returning  *
  181. *                                                                           *
  182. *             fuction return key stroked pressed or 0 if none pressed.      *
  183. *                                                                           *
  184. *                                                                           *
  185. ****************************************************************************/
  186.  
  187.  
  188. int sfkb_kbhit(int *ascii,int *function);
  189. /****************************************************************************
  190. *  sfkb_kbhit -  check for keyboard hit but does not take key of the        *
  191. *                keystroke of the key board buffer. Will return             *
  192. *                the ascii or function key.                                 *
  193. *     funciton returns  0 for no key stroke                                 *
  194. *                       1 for a key stroke                                  *
  195. ****************************************************************************/
  196.  
  197.  
  198.  
  199.  
  200. void sfkb_flush(void);
  201. /******************************************************************************
  202. *  sfkb_flush  -  remove all keystrokes from keyboard buffer                  *
  203. ******************************************************************************/
  204.  
  205.  
  206.  
  207. int sfkb_get_state(int state);
  208. /******************************************************************************
  209. * sfkb_get_state   check the status of the keyboard shift/numlock/scroll lock *
  210. *                  the folowing are valid.                                    *
  211. *                  K_CAP_LOCK       0x40                                      *
  212. *                  K_NUM_LOCK       0x20                                      *
  213. *                  K_SCROLL_LOCK    0x10                                      *
  214. *                  K_LEFT_SHIFT     0x01                                      *
  215. *                  K_RIGHT_SHIFT    0x02                                      *
  216. *                  K_ALT            0x08                                      *
  217. *                  K_CTL            0x04                                      *
  218. *    returns K_ON or K_OFF                                                    *
  219. ******************************************************************************/
  220.  
  221. void sfkb_set_state(int state,int swith);
  222. /******************************************************************************
  223. * sfkb_set_state   Set key board to the following state                       *
  224. *                  K_CAP_LOCK       0x40                                      *
  225. *                  K_NUM_LOCK       0x20                                      *
  226. *                  K_SCROLL_LOCK    0x10                                      *
  227. *  with swith                                                                 *
  228. *                  K_ON                                                       *
  229. *                  K_OFF                                                      *
  230. *                                                                             *
  231. ******************************************************************************/
  232.  
  233.  
  234. int sfkb_get_mode(int mode);
  235. /*******************************************************************************
  236. * sfkb_get_mode   check keyboard mode  return K_MODE_ON or K_MODE_OFF          *
  237. *                 K_ECHO_ON                                                    *
  238. *                 K_ECHO_OFF                                                   *
  239. *                 K_RAW_MODE                                                   *
  240. *                 K_COOKED_MODE                                                *
  241. *******************************************************************************/
  242.  
  243.  
  244. void sfkb_set_mode(int mode);
  245. /*******************************************************************************
  246. * sfkb_set_mode  set the mode to the folowing                                  *
  247. *                 K_ECHO_ON                                                    *
  248. *                 K_ECHO_OFF                                                   *
  249. *                 K_RAW_MODE                                                   *
  250. *                 K_COOKED_MODE                                                *
  251. *******************************************************************************/
  252.