1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
|
/*********************************************************/
/* ptycon: a pty-console bridge */
/* Copyright (C) 2016 Z. Gilboa */
/* Released under GPLv2 and GPLv3; see COPYING.PTYCON. */
/*********************************************************/
#include <psxtypes/psxtypes.h>
#include <ntcon/ntcon.h>
#include <ntcon/ntcon_vkcode.h>
#include <ptycon/ptycon.h>
#include "ptycon_bridge_impl.h"
#define P0() {(const unsigned char[]){0},0}
#define P1(a) {(const unsigned char[]){a,0},1}
#define P2(a,b) {(const unsigned char[]){a,b,0},2}
#define P3(a,b,c) {(const unsigned char[]){a,b,c,0},3}
#define P4(a,b,c,d) {(const unsigned char[]){a,b,c,d,0},4}
#define P5(a,b,c,d,e) {(const unsigned char[]){a,b,c,d,e,0},5}
#define P6(a,b,c,d,e,f) {(const unsigned char[]){a,b,c,d,e,f,0},6}
const struct ptyc_vkcode ptyc_vkcode[0x100] = {
[VK_LBUTTON] = P0(),
[VK_RBUTTON] = P0(),
[VK_CANCEL] = P0(),
[VK_MBUTTON] = P0(),
[VK_XBUTTON1] = P0(),
[VK_XBUTTON2] = P0(),
[VK_BACK] = P0(),
[VK_TAB] = P0(),
[VK_CLEAR] = P0(),
[VK_RETURN] = P0(),
[VK_SHIFT] = P0(),
[VK_CONTROL] = P0(),
[VK_MENU] = P0(),
[VK_PAUSE] = P0(),
[VK_CAPITAL] = P0(),
[VK_HANGUL] = P0(),
[VK_JUNJA] = P0(),
[VK_FINAL] = P0(),
[VK_KANJI] = P0(),
[VK_ESCAPE] = P0(),
[VK_CONVERT] = P0(),
[VK_NONCONVERT] = P0(),
[VK_ACCEPT] = P0(),
[VK_MODECHANGE] = P0(),
[VK_SPACE] = P0(),
[VK_PRIOR] = P4(0x1b,0x5b,0x35,0x7e),
[VK_NEXT] = P4(0x1b,0x5b,0x36,0x7e),
[VK_END] = P3(0x1b,0x5b,0x46),
[VK_HOME] = P3(0x1b,0x5b,0x48),
[VK_LEFT] = P3(0x1b,0x5b,0x44),
[VK_UP] = P3(0x1b,0x5b,0x41),
[VK_RIGHT] = P3(0x1b,0x5b,0x43),
[VK_DOWN] = P3(0x1b,0x5b,0x42),
[VK_SELECT] = P0(),
[VK_PRINT] = P0(),
[VK_EXECUTE] = P0(),
[VK_SNAPSHOT] = P0(),
[VK_INSERT] = P4(0x1b,0x5b,0x32,0x7e),
[VK_DELETE] = P4(0x1b,0x5b,0x33,0x7e),
[VK_HELP] = P0(),
[VK_LWIN] = P0(),
[VK_RWIN] = P0(),
[VK_APPS] = P0(),
[VK_SLEEP] = P0(),
[VK_NUMPAD0] = P0(),
[VK_NUMPAD1] = P0(),
[VK_NUMPAD2] = P0(),
[VK_NUMPAD3] = P0(),
[VK_NUMPAD4] = P0(),
[VK_NUMPAD5] = P0(),
[VK_NUMPAD6] = P0(),
[VK_NUMPAD7] = P0(),
[VK_NUMPAD8] = P0(),
[VK_NUMPAD9] = P0(),
[VK_MULTIPLY] = P0(),
[VK_ADD] = P0(),
[VK_SEPARATOR] = P0(),
[VK_SUBTRACT] = P0(),
[VK_DECIMAL] = P0(),
[VK_DIVIDE] = P0(),
[VK_F1] = P3(0x1b,0x4f,0x50),
[VK_F2] = P3(0x1b,0x4f,0x51),
[VK_F3] = P3(0x1b,0x4f,0x52),
[VK_F4] = P3(0x1b,0x4f,0x53),
[VK_F5] = P5(0x1b,0x5b,0x31,0x35,0x7e),
[VK_F6] = P5(0x1b,0x5b,0x31,0x37,0x7e),
[VK_F7] = P5(0x1b,0x5b,0x31,0x38,0x7e),
[VK_F8] = P5(0x1b,0x5b,0x31,0x39,0x7e),
[VK_F9] = P5(0x1b,0x5b,0x32,0x30,0x7e),
[VK_F10] = P5(0x1b,0x5b,0x32,0x31,0x7e),
[VK_F11] = P5(0x1b,0x5b,0x32,0x33,0x7e),
[VK_F12] = P5(0x1b,0x5b,0x32,0x34,0x7e),
[VK_F13] = P0(),
[VK_F14] = P0(),
[VK_F15] = P0(),
[VK_F16] = P0(),
[VK_F17] = P0(),
[VK_F18] = P0(),
[VK_F19] = P0(),
[VK_F20] = P0(),
[VK_F21] = P0(),
[VK_F22] = P0(),
[VK_F23] = P0(),
[VK_F24] = P0(),
[VK_NUMLOCK] = P0(),
[VK_SCROLL] = P0(),
[VK_LSHIFT] = P0(),
[VK_RSHIFT] = P0(),
[VK_LCONTROL] = P0(),
[VK_RCONTROL] = P0(),
[VK_LMENU] = P0(),
[VK_RMENU] = P0(),
[VK_BROWSER_BACK] = P0(),
[VK_BROWSER_FORWARD] = P0(),
[VK_BROWSER_REFRESH] = P0(),
[VK_BROWSER_STOP] = P0(),
[VK_BROWSER_SEARCH] = P0(),
[VK_BROWSER_FAVORITES] = P0(),
[VK_BROWSER_HOME] = P0(),
[VK_VOLUME_MUTE] = P0(),
[VK_VOLUME_DOWN] = P0(),
[VK_VOLUME_UP] = P0(),
[VK_MEDIA_NEXT_TRACK] = P0(),
[VK_MEDIA_PREV_TRACK] = P0(),
[VK_MEDIA_STOP] = P0(),
[VK_MEDIA_PLAY_PAUSE] = P0(),
[VK_LAUNCH_MAIL] = P0(),
[VK_LAUNCH_MEDIA_SELECT] =P0(),
[VK_LAUNCH_APP1] = P0(),
[VK_LAUNCH_APP2] = P0(),
[VK_OEM_1] = P0(),
[VK_OEM_PLUS] = P0(),
[VK_OEM_COMMA] = P0(),
[VK_OEM_MINUS] = P0(),
[VK_OEM_PERIOD] = P0(),
[VK_OEM_2] = P0(),
[VK_OEM_3] = P0(),
[VK_OEM_4] = P0(),
[VK_OEM_5] = P0(),
[VK_OEM_6] = P0(),
[VK_OEM_7] = P0(),
[VK_OEM_8] = P0(),
[VK_OEM_102] = P0(),
[VK_PROCESSKEY] = P0(),
[VK_PACKET] = P0(),
[VK_ATTN] = P0(),
[VK_CRSEL] = P0(),
[VK_EXSEL] = P0(),
[VK_EREOF] = P0(),
[VK_PLAY] = P0(),
[VK_ZOOM] = P0(),
[VK_NONAME] = P0(),
[VK_PA1] = P0(),
[VK_OEM_CLEAR] = P0(),
};
|