Annotation of nono/vm/keyboard.cpp, revision 1.1.1.3

1.1       root        1: //
                      2: // nono
1.1.1.3 ! root        3: // Copyright (C) 2020 nono project
        !             4: // Licensed under nono-license.txt
1.1       root        5: //
                      6: 
                      7: #include "keyboard.h"
                      8: #include "mystring.h"
                      9: 
1.1.1.2   root       10: std::unique_ptr<Keyboard> gKeyboard;
1.1       root       11: 
                     12: // コンストラクタ
                     13: Keyboard::Keyboard()
                     14: {
                     15:        logname = "keyboard";
                     16:        devname = "Keyboard";
                     17: }
                     18: 
                     19: // デストラクタ
                     20: Keyboard::~Keyboard()
                     21: {
                     22: }
                     23: 
                     24: // キー名を返す (主にデバッグ用)
                     25: const std::string
                     26: Keyboard::GetName(uint code)
                     27: {
                     28:        if (code >= keyname.size()) {
                     29:                return string_format("(keycode=0x%x, out of range)", code);
                     30:        }
                     31:        if (keyname[code] == NULL) {
                     32:                return string_format("(keycode=0x%x)", code);
                     33:        }
                     34:        return std::string(keyname[code]);
                     35: }
                     36: 
                     37: /*static*/ std::vector<const char *>
                     38: Keyboard::keyname {
                     39:        "(none)",               // 00
                     40:        "BREAK",                // 01
                     41:        "COPY",                 // 02
                     42:        "romaji",               // 03
                     43:        "code",                 // 04
                     44:        "kigou",                // 05
                     45:        "touroku",              // 06
                     46:        "HELP",                 // 07
                     47:        "HOME",                 // 08
                     48:        "TAB",                  // 09
                     49:        "CTRL",                 // 0a
                     50:        "kana",                 // 0b
                     51:        "SHIFT_L",              // 0c
                     52:        "SHIFT_R",              // 0d
                     53:        "CAPS",                 // 0e
                     54:        "SF",                   // 0f
                     55: 
                     56:        "ESC",                  // 10
                     57:        "BS",                   // 11
                     58:        "enter",                // 12
                     59:        "INS",                  // 13
                     60:        "space",                // 14
                     61:        "DEL",                  // 15
                     62:        "XFER",                 // 16
                     63:        "VALID",                // 17
                     64:        "PF11",                 // 18
                     65:        "PF12",                 // 19
                     66:        "PF13",                 // 1a
                     67:        "PF14",                 // 1b
                     68:        "up",                   // 1c
                     69:        "left",                 // 1d
                     70:        "right",                // 1e
                     71:        "down",                 // 1f
                     72: 
                     73:        "ROLLUP",               // 20
                     74:        "ROLLDOWN",             // 21
                     75:        "1",                    // 22
                     76:        "2",                    // 23
                     77:        "3",                    // 24
                     78:        "4",                    // 25
                     79:        "5",                    // 26
                     80:        "6",                    // 27
                     81:        "7",                    // 28
                     82:        "8",                    // 29
                     83:        "9",                    // 2a
                     84:        "0",                    // 2b
                     85:        "minus",                // 2c
                     86:        "circum",               // 2d
                     87:        "backslash",    // 2e
                     88:        "UNDO",                 // 2f
                     89: 
                     90:        "OPT1",                 // 30
                     91:        "OPT2",                 // 31
                     92:        "Q",                    // 32
                     93:        "W",                    // 33
                     94:        "E",                    // 34
                     95:        "R",                    // 35
                     96:        "T",                    // 36
                     97:        "Y",                    // 37
                     98:        "U",                    // 38
                     99:        "I",                    // 39
                    100:        "O",                    // 3a
                    101:        "P",                    // 3b
                    102:        "at",                   // 3c
                    103:        "bracketleft",  // 3d
                    104:        "hira",                 // 3e
                    105:        "zenkaku",              // 3f
                    106: 
                    107:        NULL,                   // 40
                    108:        NULL,                   // 41
                    109:        "A",                    // 42
                    110:        "S",                    // 43
                    111:        "D",                    // 44
                    112:        "F",                    // 45
                    113:        "G",                    // 46
                    114:        "H",                    // 47
                    115:        "J",                    // 48
                    116:        "K",                    // 49
                    117:        "L",                    // 4a
                    118:        "semicolon",    // 4b
                    119:        "colon",                // 4c
                    120:        "bracketright", // 4d
                    121:        NULL,                   // 4e
                    122:        NULL,                   // 4f
                    123: 
                    124:        NULL,                   // 50
                    125:        NULL,                   // 51
                    126:        "Z",                    // 52
                    127:        "X",                    // 53
                    128:        "C",                    // 54
                    129:        "V",                    // 55
                    130:        "B",                    // 56
                    131:        "N",                    // 57
                    132:        "M",                    // 58
                    133:        "comma",                // 59
                    134:        "period",               // 5a
                    135:        "slash",                // 5b
                    136:        "underscore",   // 5c
                    137:        NULL,                   // 5d
                    138:        NULL,                   // 5e
                    139:        NULL,                   // 5f
                    140: 
                    141:        NULL,                   // 60
                    142:        "PAD_plus",             // 61
                    143:        "PAD_minus",    // 62
                    144:        "PAD_7",                // 63
                    145:        "PAD_8",                // 64
                    146:        "PAD_9",                // 65
                    147:        "PAD_4",                // 66
                    148:        "PAD_5",                // 67
                    149:        "PAD_6",                // 68
                    150:        "PAD_1",                // 69
                    151:        "PAD_2",                // 6a
                    152:        "PAD_3",                // 6b
                    153:        "PAD_0",                // 6c
                    154:        "PAD_decimal",  // 6d
                    155:        "PAD_enter",    // 6e
                    156:        "PAD_CLR",              // 6f
                    157: 
                    158:        NULL,                   // 70
                    159:        NULL,                   // 71
                    160:        "F1",                   // 72
                    161:        "F2",                   // 73
                    162:        "F3",                   // 74
                    163:        "F4",                   // 75
                    164:        "F5",                   // 76
                    165:        "F6",                   // 77
                    166:        "F7",                   // 78
                    167:        "F8",                   // 79
                    168:        "F9",                   // 7a
                    169:        "F10",                  // 7b
                    170:        "PAD_multiply", // 7c
                    171:        "PAD_divide",   // 7d
                    172:        "PAD_equal",    // 7e
                    173:        "PAD_comma",    // 7f
                    174: 
                    175:        "XF1",                  // 80
                    176:        "XF2",                  // 81
                    177:        "XF3",                  // 82
                    178:        "XF4",                  // 83
                    179:        "XF5",                  // 84
                    180: };

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.