home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / bsd_srcs / sys / hp300 / dev / hil_keymaps.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-05-08  |  10.6 KB  |  258 lines

  1. /*
  2.  * Copyright (c) 1988 University of Utah.
  3.  * Copyright (c) 1990 The Regents of the University of California.
  4.  * All rights reserved.
  5.  *
  6.  * This code is derived from software contributed to Berkeley by
  7.  * the Systems Programming Group of the University of Utah Computer
  8.  * Science Department.
  9.  *
  10.  * Redistribution and use in source and binary forms, with or without
  11.  * modification, are permitted provided that the following conditions
  12.  * are met:
  13.  * 1. Redistributions of source code must retain the above copyright
  14.  *    notice, this list of conditions and the following disclaimer.
  15.  * 2. Redistributions in binary form must reproduce the above copyright
  16.  *    notice, this list of conditions and the following disclaimer in the
  17.  *    documentation and/or other materials provided with the distribution.
  18.  * 3. All advertising materials mentioning features or use of this software
  19.  *    must display the following acknowledgement:
  20.  *    This product includes software developed by the University of
  21.  *    California, Berkeley and its contributors.
  22.  * 4. Neither the name of the University nor the names of its contributors
  23.  *    may be used to endorse or promote products derived from this software
  24.  *    without specific prior written permission.
  25.  *
  26.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  27.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  28.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  29.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  30.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  31.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  32.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  33.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  34.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  35.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  36.  * SUCH DAMAGE.
  37.  *
  38.  * from: Utah $Hdr: hil_keymaps.c 1.1 90/07/09$
  39.  *
  40.  *    @(#)hil_keymaps.c    7.3 (Berkeley) 12/16/90
  41.  */
  42.  
  43. /*
  44.  * Keymaps for various HP-HIL keyboard layouts.  These tables apply only to
  45.  * keyboards in "cooked" mode.  Currently only one is supported as an ITE
  46.  * keyboard.
  47.  *
  48.  * Maps are indexed by cooked keycode and contain the ASCII character for
  49.  * that keycode.  The map-set used depends on the keyboard "language".  The
  50.  * map used within that set depends on the shift/control status that is
  51.  * returned by the hardware along with the keycode.  If an entry is NULL for
  52.  * a key in the appropriate unshifted, shifted, control, or control-shifted
  53.  * table, then a single "string" table is consulted.  In this fashion, a
  54.  * multi- character sequence can be returned for a key press.  Note that
  55.  * control/shift status have no effect on multi-character lookup (i.e. there
  56.  * is only one string table per set, not four).
  57.  *
  58.  * Someday we could allow user-definable keymaps, but we would have to come up
  59.  * with a better format (at least externally).  This format takes up lots of
  60.  * space.  Having keymaps for all 18 or so HP supported layouts would be bad
  61.  * news.
  62.  */
  63. #include "sys/param.h"
  64. #include "kbdmap.h"
  65.  
  66. char    us_keymap[] = {
  67.     NULL,    '`',    '\\',    ESC,    NULL,    DEL,    NULL,    NULL,  
  68.     '\n',    '\t',    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,  
  69.     NULL,    '\n',    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,  
  70.     NULL,    '\t',    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,
  71.     NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,
  72.     NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    '\b',    NULL,
  73.     NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,
  74.     ESC,    '\r',    NULL,    '\n',    '0',    '.',    ',',    '+',
  75.     '1',    '2',    '3',    '-',    '4',    '5',    '6',    '*',
  76.     '7',    '8',    '9',    '/',    'E',    '(',    ')',    '^',
  77.     '1',    '2',    '3',    '4',    '5',    '6',    '7',    '8',
  78.     '9',    '0',    '-',    '=',    '[',    ']',    ';',    '\'',
  79.     ',',    '.',    '/',    '\040',    'o',    'p',    'k',    'l',
  80.     'q',    'w',    'e',    'r',    't',    'y',    'u',    'i',
  81.     'a',    's',    'd',    'f',    'g',    'h',    'j',    'm',
  82.     'z',    'x',    'c',    'v',    'b',    'n',    NULL,    NULL
  83. };
  84.  
  85. char    us_shiftmap[] = {
  86.     NULL,    '~',    '|',    DEL,    NULL,    DEL,    NULL,    NULL,
  87.     '\n',    '\t',    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,
  88.     NULL,    '\n',    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,
  89.     NULL,    '\t',    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,
  90.     NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,
  91.     NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    DEL,    NULL,
  92.     NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,
  93.     ESC,    '\r',    NULL,    '\n',    '0',    '.',    ',',    '+',
  94.     '1',    '2',    '3',    '-',    '4',    '5',    '6',    '*',
  95.     '7',    '8',    '9',    '/',    '`',    '|',    '\\',    '~',
  96.     '!',    '@',    '#',    '$',    '%',    '^',    '&',    '*',
  97.     '(',    ')',    '_',    '+',    '{',    '}',    ':',    '\"',
  98.     '<',    '>',    '?',    '\040',    'O',    'P',    'K',    'L',
  99.     'Q',    'W',    'E',    'R',    'T',    'Y',    'U',    'I',
  100.     'A',    'S',    'D',    'F',    'G',    'H',    'J',    'M',
  101.     'Z',    'X',    'C',    'V',    'B',    'N',    NULL,    NULL
  102. };
  103.  
  104. char    us_ctrlmap[] = {
  105.     NULL,    '`',    '\034',    ESC,    NULL,    DEL,    NULL,    NULL,
  106.     '\n',    '\t',    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,
  107.     NULL,    '\n',    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,
  108.     NULL,    '\t',    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,
  109.     NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,
  110.     NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    '\b',    NULL,
  111.     NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,
  112.     ESC,    '\r',    NULL,    '\n',    '0',    '.',    ',',    '+',
  113.     '1',    '2',    '3',    '-',    '4',    '5',    '6',    '*',
  114.     '7',    '8',    '9',    '/',    'E',    '(',    ')',    '\036',
  115.     '1',    '2',    '3',    '4',    '5',    '6',    '7',    '8',
  116.     '9',    '0',    '-',    '=',    '\033',    '\035',    ';',    '\'',
  117.     ',',    '.',    '/',    '\040',    '\017',    '\020',    '\013',    '\014',
  118.     '\021',    '\027',    '\005',    '\022',    '\024',    '\031',    '\025',    '\011',
  119.     '\001',    '\023',    '\004',    '\006',    '\007',    '\010',    '\012',    '\015',
  120.     '\032',    '\030',    '\003',    '\026',    '\002',    '\016',    NULL,    NULL
  121. };
  122.  
  123. char    us_ctrlshiftmap[] = {
  124.     NULL,    '~',    '|',    DEL,    NULL,    DEL,    NULL,    NULL,
  125.     '\n',    '\t',    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,
  126.     NULL,    '\n',    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,
  127.     NULL,    '\t',    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,
  128.     NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,
  129.     NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    DEL,    NULL,
  130.     NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,
  131.     ESC,    '\r',    NULL,    '\n',    '0',    '.',    ',',    '+',
  132.     '1',    '2',    '3',    '-',    '4',    '5',    '6',    '*',
  133.     '7',    '8',    '9',    '/',    '`',    '|',    '\034',    '~',
  134.     '!',    '\000',    '#',    '$',    '%',    '\036',    '&',    '*',
  135.     '(',    ')',    '\037',    '+',    '{',    '}',    ':',    '\"',
  136.     '<',    '>',    '?',    '\040',    '\017',    '\020',    '\013',    '\014',
  137.     '\021',    '\027',    '\005',    '\022',    '\024',    '\031',    '\025',    '\011',
  138.     '\001',    '\023',    '\004',    '\006',    '\007',    '\010',    '\012',    '\015',
  139.     '\032',    '\030',    '\003',    '\026',    '\002',    '\016',    NULL,    NULL
  140. };
  141.  
  142. char    *us_stringmap[] = {
  143.     NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,
  144.     NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    "\033V","\033h",
  145.     "\033U",NULL,    NULL,    NULL,    NULL,    NULL,    "\033K","\033J",
  146.     NULL,    NULL,    NULL,    "\033p","\033q","\033t","\033u","\033v",
  147.     "\033r","\033s","\033B","\033A","\033w",NULL,    "\033D","\033C",
  148.     "\033L","\033M",NULL,    NULL,    "\033P",NULL,    NULL,    NULL,
  149.     NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,
  150.     NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,
  151.     NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,
  152.     NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,
  153.     NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,
  154.     NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,
  155.     NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,
  156.     NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,
  157.     NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,
  158.     NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL
  159. };
  160.  
  161. #ifdef UK_KEYBOARD
  162. char    uk_keymap[] = {
  163.     NULL,    '`',    '<',    ESC,    NULL,    DEL,    NULL,    NULL,  
  164.     '\n',    '\t',    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,  
  165.     NULL,    '\n',    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,  
  166.     NULL,    '\t',    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,
  167.     NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,
  168.     NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    '\b',    NULL,
  169.     NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,
  170.     ESC,    '\r',    NULL,    '\n',    '0',    '.',    ',',    '+',
  171.     '1',    '2',    '3',    '-',    '4',    '5',    '6',    '*',
  172.     '7',    '8',    '9',    '/',    'E',    '(',    ')',    '^',
  173.     '1',    '2',    '3',    '4',    '5',    '6',    '7',    '8',
  174.     '9',    '0',    '+',    '\'',    '[',    ']',    '*',    '\\',
  175.     ',',    '.',    '-',    '\040',    'o',    'p',    'k',    'l',
  176.     'q',    'w',    'e',    'r',    't',    'y',    'u',    'i',
  177.     'a',    's',    'd',    'f',    'g',    'h',    'j',    'm',
  178.     'z',    'x',    'c',    'v',    'b',    'n',    NULL,    NULL
  179. };
  180.  
  181. char    uk_shiftmap[] = {
  182.     NULL,    '~',    '>',    DEL,    NULL,    DEL,    NULL,    NULL,
  183.     '\n',    '\t',    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,
  184.     NULL,    '\n',    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,
  185.     NULL,    '\t',    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,
  186.     NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,
  187.     NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    DEL,    NULL,
  188.     NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,
  189.     ESC,    '\r',    NULL,    '\n',    '0',    '.',    ',',    '+',
  190.     '1',    '2',    '3',    '-',    '4',    '5',    '6',    '*',
  191.     '7',    '8',    '9',    '/',    '`',    '|',    '\\',    '~',
  192.     '!',    '\"',    '#',    '$',    '%',    '&',    '^',    '(',
  193.     ')',    '=',    '?',    '/',    '{',    '}',    '@',    '|',
  194.     ';',    ':',    '_',    '\040',    'O',    'P',    'K',    'L',
  195.     'Q',    'W',    'E',    'R',    'T',    'Y',    'U',    'I',
  196.     'A',    'S',    'D',    'F',    'G',    'H',    'J',    'M',
  197.     'Z',    'X',    'C',    'V',    'B',    'N',    NULL,    NULL
  198. };
  199.  
  200. char    uk_ctrlmap[] = {
  201.     NULL,    '`',    '<',    ESC,    NULL,    DEL,    NULL,    NULL,
  202.     '\n',    '\t',    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,
  203.     NULL,    '\n',    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,
  204.     NULL,    '\t',    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,
  205.     NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,
  206.     NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    '\b',    NULL,
  207.     NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,
  208.     ESC,    '\r',    NULL,    '\n',    '0',    '.',    ',',    '+',
  209.     '1',    '2',    '3',    '-',    '4',    '5',    '6',    '*',
  210.     '7',    '8',    '9',    '/',    'E',    '(',    ')',    '\036',
  211.     '1',    '2',    '3',    '4',    '5',    '6',    '7',    '8',
  212.     '9',    '0',    '+',    '\'',    '\033',    '\035',    '*',    '\034',
  213.     ',',    '.',    '/',    '\040',    '\017',    '\020',    '\013',    '\014',
  214.     '\021',    '\027',    '\005',    '\022',    '\024',    '\031',    '\025',    '\011',
  215.     '\001',    '\023',    '\004',    '\006',    '\007',    '\010',    '\012',    '\015',
  216.     '\032',    '\030',    '\003',    '\026',    '\002',    '\016',    NULL,    NULL
  217. };
  218.  
  219. char    uk_ctrlshiftmap[] = {
  220.     NULL,    '~',    '>',    DEL,    NULL,    DEL,    NULL,    NULL,
  221.     '\n',    '\t',    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,
  222.     NULL,    '\n',    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,
  223.     NULL,    '\t',    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,
  224.     NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,
  225.     NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    DEL,    NULL,
  226.     NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,    NULL,
  227.     ESC,    '\r',    NULL,    '\n',    '0',    '.',    ',',    '+',
  228.     '1',    '2',    '3',    '-',    '4',    '5',    '6',    '*',
  229.     '7',    '8',    '9',    '/',    '`',    '|',    '\034',    '~',
  230.     '!',    '\"',    '#',    '$',    '%',    '&',    '\036',    '(',
  231.     ')',    '=',    '?',    '/',    '{',    '}',    '\000',    '|',
  232.     ';',    ':',    '\037',    '\040',    '\017',    '\020',    '\013',    '\014',
  233.     '\021',    '\027',    '\005',    '\022',    '\024',    '\031',    '\025',    '\011',
  234.     '\001',    '\023',    '\004',    '\006',    '\007',    '\010',    '\012',    '\015',
  235.     '\032',    '\030',    '\003',    '\026',    '\002',    '\016',    NULL,    NULL
  236. };
  237. #endif
  238.  
  239. /*
  240.  * The keyboard map table.
  241.  * Lookup is by hardware returned language code.
  242.  */
  243. struct kbdmap kbd_map[] = {
  244.     KBD_US,        "US ASCII",
  245.     us_keymap,    us_shiftmap,    us_ctrlmap,    us_ctrlshiftmap,
  246.     us_stringmap,
  247.  
  248. #ifdef UK_KEYBOARD
  249.     KBD_UK,        "United Kingdom",
  250.     uk_keymap,    uk_shiftmap,    uk_ctrlmap,    uk_ctrlshiftmap,
  251.     us_stringmap,
  252. #endif
  253.  
  254.     0,        NULL,
  255.     NULL,        NULL,        NULL,        NULL,
  256.     NULL,
  257. };
  258.