Source code of Windows XP (NT5)
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.

118 lines
3.0 KiB

  1. /****************************** Module Header ******************************\
  2. * Module Name: kbdx.h
  3. *
  4. * Copyright (c) 1985-95, Microsoft Corporation
  5. *
  6. * History:
  7. * 26-Mar-1995 a-KChang
  8. \***************************************************************************/
  9. #include <string.h>
  10. #include <stdarg.h>
  11. #include <stdio.h>
  12. #include <stdlib.h>
  13. #include <malloc.h>
  14. #include <time.h>
  15. #include <windef.h>
  16. #define KBDSHIFT 1
  17. #define KBDCTRL 2
  18. #define KBDALT 4
  19. #define CAPLOK 0x01
  20. #define SGCAPS 0x02
  21. #define CAPLOKALTGR 0x04
  22. #define LINEBUFSIZE 256
  23. #define WORDBUFSIZE 32
  24. #define MAXWCLENGTH 8
  25. #define MAXKBDNAME 6
  26. #define MAXSTATES 65
  27. #define FILENAMESIZE 13
  28. #define FAILURE 0
  29. #define SUCCESS 1
  30. /*
  31. * max. number of characters per ligature.
  32. * Currently only the Arabic layouts use
  33. * ligatures, and they have a maximum of
  34. * two characters per ligatures. This should
  35. * provide plenty of room for growth.
  36. */
  37. #define MAXLIGATURES 5
  38. /*
  39. * Statically initialized to store default ScanCode-VK relation
  40. * Copied into Layout[] by doLAYOUT()
  41. */
  42. typedef struct {
  43. USHORT Scan;
  44. BYTE VKey;
  45. char *VKeyName;
  46. BOOL bUsed;
  47. } SC_VK;
  48. /* virtual key name, used only by those other than 0-9 and A-Z */
  49. typedef struct {
  50. int VKey;
  51. char *pName;
  52. } VKEYNAME;
  53. /* store LAYOUT */
  54. typedef struct _layout{
  55. USHORT Scan;
  56. BYTE VKey;
  57. BYTE VKeyDefault; /* VK for this Scancode as in kbd.h */
  58. BYTE Cap; /* 0; 1 = CAPLOK; 2 = SGCAP */
  59. int nState; /* number of valid states for WCh[] */
  60. int WCh[MAXSTATES];
  61. int DKy[MAXSTATES]; /* is it a dead key ? */
  62. int LKy[MAXSTATES]; /* is it a ligature ? */
  63. struct _layout *pSGCAP; /* store extra struct for SGCAP */
  64. char * VKeyName; /* Optional name for VK */
  65. BOOL defined; /* prevent redefining */
  66. int nLine; /* from input file line number */
  67. } KEYLAYOUT, *PKEYLAYOUT;
  68. /* generic link list header */
  69. typedef struct {
  70. int Count;
  71. void *pBeg;
  72. void *pEnd;
  73. } LISTHEAD;
  74. /* store each DEADTRANS */
  75. typedef struct _DeadTrans {
  76. DWORD Base;
  77. DWORD WChar;
  78. USHORT uFlags;
  79. struct _DeadTrans *pNext;
  80. } DEADTRANS, *PDEADTRANS;
  81. /* store Key Name */
  82. /* store each DEADKEY */
  83. typedef struct _Dead{
  84. DWORD Dead;
  85. PDEADTRANS pDeadTrans;
  86. struct _Dead *pNext;
  87. } DEADKEY, *PDEADKEY;
  88. /* store LIGATURE */
  89. typedef struct _ligature{
  90. struct _ligature *pNext;
  91. BYTE VKey;
  92. BYTE Mod; /* Shift State */
  93. int nCharacters; /* number of characters for this ligature */
  94. int WCh[MAXLIGATURES];
  95. } LIGATURE, *PLIGATURE;
  96. typedef struct _Name {
  97. DWORD Code;
  98. char *pName;
  99. struct _Name *pNext;
  100. } KEYNAME, *PKEYNAME;
  101. extern int getopt(int argc, char **argv, char *opts);
  102. extern int optind;