forked from microsoft/calculator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCommand.h
227 lines (204 loc) · 5.75 KB
/
Command.h
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#pragma once
namespace UnitConversionManager
{
enum class Command
{
Zero, One, Two, Three, Four, Five, Six, Seven, Eight, Nine,
Decimal,
Negate, Backspace,
Clear,
Reset,
None
};
}
namespace CurrencyConversionManager
{
enum class Command
{
Zero, One, Two, Three, Four, Five, Six, Seven, Eight, Nine,
Decimal,
Negate, Backspace,
Clear,
None
};
}
namespace CalculationManager
{
enum class CommandType
{
UnaryCommand,
BinaryCommand,
OperandCommand,
Parentheses
};
enum class Command
{
// Commands for programmer calculators are omitted.
CommandDEG = 321,
CommandRAD = 322,
CommandGRAD = 323,
CommandDegrees = 324,
CommandHYP = 325,
CommandNULL = 0,
// No new command should not be added before CommandSign, 80
// If it is needed, the following two functions need to be revised too.
// CalculatorManager::MapCommandForSerialize(Command command);
// CalculatorManager::MapCommandForDeSerialize(unsigned char command);
CommandSIGN = 80,
CommandCLEAR = 81,
CommandCENTR = 82,
CommandBACK = 83,
CommandPNT = 84,
// Hole 85
// Unused commands defined in Command.h is omitted.
CommandXor = 88,
CommandLSHF = 89,
CommandRSHF = 90,
CommandDIV = 91,
CommandMUL = 92,
CommandADD = 93,
CommandSUB = 94,
CommandMOD = 95,
CommandROOT = 96,
CommandPWR = 97,
CommandCHOP = 98, // Unary operators must be between CommandCHOP and CommandEQU
CommandROL = 99,
CommandROR = 100,
CommandCOM = 101,
CommandSIN = 102,
CommandCOS = 103,
CommandTAN = 104,
CommandSINH = 105,
CommandCOSH = 106,
CommandTANH = 107,
CommandLN = 108,
CommandLOG = 109,
CommandSQRT = 110,
CommandSQR = 111,
CommandCUB = 112,
CommandFAC = 113,
CommandREC = 114,
CommandDMS = 115,
CommandCUBEROOT = 116, //x ^ 1/3
CommandPOW10 = 117, // 10 ^ x
CommandPERCENT = 118,
CommandFE = 119,
CommandPI = 120,
CommandEQU = 121,
CommandMCLEAR = 122,
CommandRECALL = 123,
CommandSTORE = 124,
CommandMPLUS = 125,
CommandMMINUS = 126,
CommandEXP = 127,
CommandOPENP = 128,
CommandCLOSEP = 129,
Command0 = 130, // The controls for 0 through F must be consecutive and in order
Command1 = 131,
Command2 = 132,
Command3 = 133,
Command4 = 134,
Command5 = 135,
Command6 = 136,
Command7 = 137,
Command8 = 138,
Command9 = 139,
CommandA = 140,
CommandB = 141,
CommandC = 142,
CommandD = 143,
CommandE = 144,
CommandF = 145, // this is last control ID which must match the string table
CommandINV = 146,
CommandSET_RESULT = 147,
CommandAnd = 86,
CommandOR = 87,
CommandNot = 101,
ModeBasic = 200,
ModeScientific = 201,
CommandASIN = 202,
CommandACOS = 203,
CommandATAN = 204,
CommandPOWE = 205,
CommandASINH = 206,
CommandACOSH = 207,
CommandATANH = 208,
ModeProgrammer = 209,
CommandHex = 313,
CommandDec = 314,
CommandOct = 315,
CommandBin = 316,
CommandQword = 317,
CommandDword = 318,
CommandWord = 319,
CommandByte = 320,
CommandBINEDITSTART = 700,
CommandBINPOS0 = 700,
CommandBINPOS1 = 701,
CommandBINPOS2 = 702,
CommandBINPOS3 = 703,
CommandBINPOS4 = 704,
CommandBINPOS5 = 705,
CommandBINPOS6 = 706,
CommandBINPOS7 = 707,
CommandBINPOS8 = 708,
CommandBINPOS9 = 709,
CommandBINPOS10 = 710,
CommandBINPOS11 = 711,
CommandBINPOS12 = 712,
CommandBINPOS13 = 713,
CommandBINPOS14 = 714,
CommandBINPOS15 = 715,
CommandBINPOS16 = 716,
CommandBINPOS17 = 717,
CommandBINPOS18 = 718,
CommandBINPOS19 = 719,
CommandBINPOS20 = 720,
CommandBINPOS21 = 721,
CommandBINPOS22 = 722,
CommandBINPOS23 = 723,
CommandBINPOS24 = 724,
CommandBINPOS25 = 725,
CommandBINPOS26 = 726,
CommandBINPOS27 = 727,
CommandBINPOS28 = 728,
CommandBINPOS29 = 729,
CommandBINPOS30 = 730,
CommandBINPOS31 = 731,
CommandBINPOS32 = 732,
CommandBINPOS33 = 733,
CommandBINPOS34 = 734,
CommandBINPOS35 = 735,
CommandBINPOS36 = 736,
CommandBINPOS37 = 737,
CommandBINPOS38 = 738,
CommandBINPOS39 = 739,
CommandBINPOS40 = 740,
CommandBINPOS41 = 741,
CommandBINPOS42 = 742,
CommandBINPOS43 = 743,
CommandBINPOS44 = 744,
CommandBINPOS45 = 745,
CommandBINPOS46 = 746,
CommandBINPOS47 = 747,
CommandBINPOS48 = 748,
CommandBINPOS49 = 749,
CommandBINPOS50 = 750,
CommandBINPOS51 = 751,
CommandBINPOS52 = 752,
CommandBINPOS53 = 753,
CommandBINPOS54 = 754,
CommandBINPOS55 = 755,
CommandBINPOS56 = 756,
CommandBINPOS57 = 757,
CommandBINPOS58 = 758,
CommandBINPOS59 = 759,
CommandBINPOS60 = 760,
CommandBINPOS61 = 761,
CommandBINPOS62 = 762,
CommandBINPOS63 = 763,
CommandBINEDITEND = 763
};
}