home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / SWAPDCP.LZH / swapdcp.h < prev   
Text File  |  1992-06-13  |  4KB  |  100 lines

  1. /* SWAPDCP header file */
  2.  
  3. #if defined( __IBMC__ )
  4.     #pragma pack(1)
  5.     typedef unsigned short     WORD;    /* 16-bit unsigned thing */
  6.     typedef unsigned char      BYTE;
  7.     typedef unsigned         BITFIELD;  /* for readability */
  8.     typedef unsigned long      ULONG;
  9. #elif defined( __ZTC__ )
  10.     #pragma ZTC align 1
  11.     typedef unsigned short     WORD;    /* 16-bit unsigned thing */
  12.     typedef unsigned char      BYTE;
  13.     typedef unsigned long    BITFIELD;  /* for readability */
  14.     typedef unsigned long      ULONG;
  15. #else
  16. #error    "unknown compiler"
  17. #endif
  18.  
  19. /* code page header */
  20. typedef struct XHeader
  21. {
  22.     WORD    XTableID;       /* code page number */
  23.  
  24.     /* note: 32-bit wide field */
  25.     struct
  26.     {
  27.         /* which shift key or key combo affects Char3 of each KeyDef */
  28.         BITFIELD    ShiftAlt    :1; /* use shift-alt instead of ctrl-alt */
  29.         BITFIELD    AltGrafL    :1; /* use left alt key as alt-graphics */
  30.         BITFIELD    AltGrafR    :1; /* use right alt key as alt-graphics */
  31.         /* other modifiers */
  32.         BITFIELD    ShiftLock   :1; /* treat caps lock as shift lock */
  33.         BITFIELD    DefaultTable:1; /* default table for the language */
  34.         BITFIELD    ShiftToggle :1; /* TRUE: toggle, FALSE: latch shiftlock */
  35.         BITFIELD    AccentPass  :1; /* TRUE: pass on accent keys and beep,
  36.                                     FALSE: just beep */
  37.         BITFIELD    CapsShift   :1; /* caps-shift uses Char5 */
  38.         BITFIELD    MachDep     :1; /* machine-dependent table */
  39.     } XTableFlags1;
  40.  
  41.     WORD    KbdType;            /* keyboard type */
  42.     WORD    KbdSubType;         /* keyboard sub-type */
  43.     WORD    XtableLen;          /* length of table */
  44.     WORD    EntryCount;         /* number of KeyDef entries */
  45.     WORD    EntryWidth;         /* width in bytes of KeyDef entries */
  46.     BYTE    Country[2];         /* country ID, i.e. 'US' */
  47.     WORD    TableTypeID;        /* Table type, 0001=OS/2 */
  48.     BYTE    SubCountryID[4];    /* sub-country ID, ASCII, i.e. '153 ' */
  49.     WORD    Reserved[8];
  50. } XHeader;
  51.  
  52. /* Key definition, one per scan code in table */
  53. typedef struct
  54. {
  55.     WORD    XlateOp;
  56.     #define     KeyType     0x01ff  /* low 9 bits */
  57.     #define     AccentFlags 0xfe00  /* high 7 bits */
  58.  
  59.     BYTE    Char1;
  60.     BYTE    Char2;
  61.     BYTE    Char3;
  62.     BYTE    Char4;
  63.     BYTE    Char5;
  64. } KeyDef;
  65.  
  66. typedef struct
  67. {
  68.     WORD    word1;
  69.     BYTE    Country[2];     /* i.e. 'US' */
  70.     BYTE    SubCountryID[4];    /* i.e. '153 ' */
  71.     WORD    word2;
  72.     WORD    XTableID;       /* i.e. 0x1b5 (437) */
  73.     WORD    word3;
  74.     ULONG   HeaderLocation; /* of beginning of table (header) */
  75. } IndexEntry;
  76.  
  77. #define MAX_SWAPPED 40
  78.  
  79. #define LIST_BASIC 1
  80. #define LIST_HEADERS 2
  81. #define LIST_KEYS 3
  82.  
  83. /* shift flags */
  84. #define SF_RIGHTSHIFT               0x0001
  85. #define SF_LEFTSHIFT                0x0002
  86. #define SF_CONTROL                  0x0004
  87. #define SF_ALT                      0x0008
  88. #define SF_SCROLLLOCK_ON            0x0010
  89. #define SF_NUMLOCK_ON               0x0020
  90. #define SF_CAPSLOCK_ON              0x0040
  91. #define SF_INSERT_ON                0x0080
  92. #define SF_LEFTCONTROL              0x0100
  93. #define SF_LEFTALT                  0x0200
  94. #define SF_RIGHTCONTROL             0x0400
  95. #define SF_RIGHTALT                 0x0800
  96. #define SF_SCROLLLOCK               0x1000
  97. #define SF_NUMLOCK                  0x2000
  98. #define SF_CAPSLOCK                 0x4000
  99. #define SF_SYSREQ                   0x8000
  100.